Re:Simple Dynamic Strings library for C
by adestefan on Thursday February 06, 2014 @12:39PM
(#7191640)
sizeof is a unary operator and not a function. Only types need to be enclosed in parens. Most people don't know this.
[ Parent
| on HN ]
Exactly! For some reason this anti-pattern is very thoroughly entrenched among C programmers and it's so very frustrating.
My other favorite is casting the return value of malloc(), something you see a great deal of and that I always oppose. See http://stackoverflow.com/questions/605845/do-i-cast-the-resu... for my best arguments.