Mail Archives: djgpp/1997/10/06/23:47:27
Michael Mauch wrote:
> Yes, you're right. I didn't test it and `sizeof int´ really doesn't
> work, whereas `char c; x = sizeof c;´ does. I'm sorry.
Correct. The relevant section of the ANSI C standard is 6.3.3.4:
The sizeof operator yields the size (in bytes) of its operand, which
may be an expression or the parenthesized name of a type. The size
is determined from the type of the operand, which is not itself
evaluated. The result is an integer constant.
Since a variable name is an expression, you don't need parentheses for
it.
--
Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
Alcyone Systems / http://www.alcyone.com/max/
San Jose, California, United States / icbm://+37.20.07/-121.53.38
\
"After each war there is a little / less democracy to save."
/ Brooks Atkinson
- Raw text -