side effects inside sizeof

duhon duhon at ihuxj.UUCP
Tue May 15 23:42:55 AEST 1984

Having read all the speculation about what "sizeof expression" should
present, I thought I'd read the manual ("The C Programming Language,"
Kernighan and Ritchie).

On page 126 we read "The expression sizeof(object) yields an
integer equal to the size of the specified object. ... The object can be
an acutual variable or array or structure, ..."
I don't see anything here about other expressions.
The confusion seems to be over the reference manual which indicates
that the grammar will accept "sizeof expression" syntactically.
This is obviously a shortcut for the compiler writer(s).
However, the semantic interpretation is explained above(p.126).

As an aside, "Programming in C," by Kockan says the following:
"The argument to the sizeof operator can be a variable, an array name,
the name of a basic data type, or the name of a derived data type."

This all seems clear to me.
			Joey Duhon

More information about the Comp.lang.c mailing list