4 ms·
sizeof is a keyword because of some terrible reason, but I'd parenthesize it just to make the intention clear.
by nurettin 4y ago
sizeof is a keyword because of some terrible reason, but I'd parenthesize it just to make the intention clear.
- Sohcahtoa82 4y agoAgreed. sizeof FEELS like a function, and so I use parentheses with it, even though I know it's not actually a function.
- krylon 4y agoWasn't there some subtle difference between using sizeof with vs without parens? Something like if you pass a type to sizeof -- e.g. sizeof(*int) -- you must use parents anyway? It's been years since I've used C, I'm probably not remembering it correctly.
- scatters 4y agoYes, exactly that. `sizeof(int)` OK, `sizeof(i)` OK, `sizeof i` OK, `sizeof int` not OK. One of those weird rules.
- sapiogram 4y agoWhy is sizeof a terrible keyword? Just think of it as an operator rather than a function.
- nurettin 4y agoShould have been a callable, or should have had consistent syntax to prevent people from being clever.