sizeof (int) - 1

Dale Worley drw at cullvax.UUCP
Thu Oct 2 06:04:04 AEST 1986


> It is interesting that the expression
> 	sizeof (int) - 1
> is ambiguous in C, for it can be parsed as
> 	sizeof ((int)(- 1))
> or as
> 	(sizeof(int)) - 1
> 
> Think about it!

Both K&R (App. A, 7.2) and Harbison&Steele (7.4.2) note that it is
ambiguous on the face of it, and that it is to be resolved in favor of
	(sizeof (int)) - 1

Dale



More information about the Comp.lang.c mailing list