sizeof() confusion

Doug Gwyn gwyn at smoke.brl.mil
Fri Nov 16 05:17:53 AEST 1990


In article <1990Nov14.154213.27324 at cbnewsj.att.com> asd at cbnewsj.att.com (Adam S. Denton) writes:
>You take sizeof() of an object, not an expression.

Not so; there are two distinct uses of sizeof:
	sizeof unary_expression
	sizeof ( type_name )

The former does operate on an expression; however the expression is not
evaluated (so no side effects occur), only the type of the expression is
relevant.

A particularly simple form of unary expression consists of just the
identifier for an object, but more complex expressions are permitted.

>Your [dhesi's] view is nice, but is not C.
>[...]
>It is the responsibility of the programmer to know the language
>and use it properly, whether the language is perfect or not.

Now that you got right.



More information about the Comp.lang.c mailing list