TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Paul Edwards
from: andrew clarke
date: 1996-10-15 15:10:24
subject: sizeof

13 Oct 96 22:41, Paul Edwards wrote to Paul Wankadia:

 > The sizeof operator yields the size (in bytes) of its operand, which 
 > may be an expression or the parenthesized name of a type.

 > Now, as far as I am aware, an "expression" would include putting the 
 > variable in parentheses, e.g. x and (x) should both be valid 
 > expressions.  Is there are circumstance where x would work, but (x) 
 > wouldn't?  Not that comes to mind.  What about the reverse?

If sizeof is being applied to a type then parentheses are required,
otherwise they are optional.  In other words, if x is of type int, both
sizeof x and sizeof(x) are valid.  However, if x happens to be a type, eg.

typedef int x;

then sizeof(x) is valid but sizeof x is not.

Regards
Andrew

-- randy{at}zws.com

--- Msged/2 4.00

* Origin: Blizzard of Ozz, Melbourne, Australia (3:635/728.4{at}fidonet)
SEEN-BY: 633/267 270
@PATH: 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.