>> I suspect some ambiguity without the parentheses, but I fail do make
>> up one.
> The expression 'sizeof int * + 1' has two different interpretations:
> sizeof(int) * (+1)
> sizeof(int *) + 1
There's also
sizeof (int) - 1
which is ambiguous even _with_ the parens; it means either
Am 25.11.2024 um 17:26 schrieb Edgar Fuß:
> Why does C's sizeof operator need parentheses when applied to a type?
>
> I suspect some ambiguity without the parentheses, but I fail do make up one.
The expression 'sizeof int * + 1' has two different interpretations:
sizeof(int) * (+1)
sizeof(int *)
On Mon, Nov 25, 2024 at 05:26:22PM +0100, Edgar Fuß wrote:
> May I use the wisdom of this list for a question that is not NetBSD-related?
>
> Why does C's sizeof operator need parentheses when applied to a type?
Because the version with paranthesis gets a "type-id" instead of an
expression, and t
May I use the wisdom of this list for a question that is not NetBSD-related?
Why does C's sizeof operator need parentheses when applied to a type?
A colleague argued that this resembles the typecast syntax (like typecasting
nothing to the type in question).
I suspect some ambiguity without the p