>>9 sizeof causes no dereference to occur. Only the size of the object (based on its type) is taken into account. This example, double *dp = alloc(sizeof *dp);, is from the C standard itself.
yesh what >>10-san say. Sizeof doesn't evaluate the expression, it just infers the type of the expression, and then retrieves the size of the expression's type.
>>11
Reread the standard you faggot. sizeof() can evaluate an expression.
Name:
Anonymous2012-01-19 16:34
>>11 Sizeof doesn't evaluate the expression, it just infers the type of the expression, and then retrieves the size of the expression's type.
And before you get your panties in a bundle, let me quote the standard...
"The sizeof operator yields the size (in bytes of its operand), which may be an expression or parenthesized name of a type. The size is determined from the type of the operand. The result is an integer. If the type of operand is a variable length array type, the operarand is evaluated; otherwise the operand is not evaluated and the result is an integer constant."
So, shouldn't that actually output sizeof (char *), given a is evaluated (since it's a VLA) and the value of an array is a pointer to its first element?
>>34
I can see a lot of things wrong with it. The program has no intentional side-effects so I will decline to comment on how well defined its behavior is. Print something or return something, right now it's a function of nothing.