News for hackers. Stuff that matters.
Re:Modern C [pdf] by colanderman on Monday November 28, 2016 @11:16AM (#13056327)
Everyone should write your second example. The first does nothing but confuse. C has enough hazing rituals without garbage like "-->".

The fewer tricks and patterns you use in C, the higher chance actual bugs have of being caught. Cutesy tricks like "-->" confuse human analysis and gain nothing.

Re:Modern C [pdf] by yoha on Monday November 28, 2016 @11:27AM (#13056422)
This is about weighing correction versus readability. In the "arrow operator" version, the readability is decreased; in the "proper" version, a type cast is required, and this can lead to bugs with values greater than 2^sizeof(ssize_t).

Obviously, I just follow the convention when contributing to an existing project.

Re:Modern C [pdf] by cygx on Monday November 28, 2016 @11:38AM (#13056498)
this can lead to bugs with values greater than 2^sizeof(ssize_t)

The range of indexable array elements is not only constrained by the unsigned type size_t, but also by the signed type ptrdiff_t, so you could always go with the latter instead of the non-ISO ssize_t.

Re:Modern C [pdf] by pwdisswordfish on Monday November 28, 2016 @11:34AM (#13056470)
...values greater than 10?