On Wed, Jan 28, 2026 at 11:00:21PM +0100, Alejandro Colomar via Mutt-dev wrote:
> On 2026-01-28T21:46:14+0000, Ian Collier via Mutt-dev wrote:
> > I disagree.  The parens actually tell you whether the argument is a type
> > or a variable.

> This is not true.  Consider the following counter-example:

>       sizeof(int)1

Here, (int) is a type, while (int)1 is an expression that happens to start
with a type-cast.  It's not a direct counterexample to my statement.  Of
course my statement isn't universally true, because it's in reply to the
suggestion from you to use parens in every case and not just for types
and clearly the parens don't tell you anything when you've done that.

So, yes you can write a complicated expression after sizeof and you might
use parens in that expression.  You could write 'sizeof (1+2)' if you wanted,
but I wouldn't recommend it.

Because 'sizeof (int)i' could be considered confusing to the reader, I would
favour bracketing the whole expression in that case.  But even better, just
don't write complicated expressions as the arguments to 'sizeof'!

imc

Reply via email to