3 ms·
Or ... sizeof(*f->buf)? I’d forgotten that sizeof even allows dropping the parens, but isn’t that asking for trouble? “sizeof a <op> b” is sometimes parsed as “
by dahart 4y ago
Or ... sizeof(*f->buf)? I’d forgotten that sizeof even allows dropping the parens, but isn’t that asking for trouble? “sizeof a <op> b” is sometimes parsed as “sizeof(a) <op> b” and sometimes as “sizeof(a <op> b) depending on the precedence of operator <op>. Is there any downside to always using parens and writing sizeof() like a function call?
- unwind 4y agoSure, many people like that style, I don't. But no, I don't think there are any downsides, but there is this notion that things should look like what they are, which is popular in C. With parens, I would suggest spaces to make it sizeof (*f->buf) that makes it look less like a function call in many styles.