X3J11 Pleasanton meeting summary

Henry Spencer henry at zoo.toronto.edu
Sat Oct 6 13:32:09 AEST 1990


In article <12672 at ogicse.ogi.edu> daniels at ogicse.ogi.edu (Scott David Daniels) writes:
>However, the preceding example is really no different.  If we presume the
>fortuitous ``to-be-filled-in-later size variable,'' the return statement 
>of the preceding example may load the return value register (or whatever 
>convention the compiler prefers for results) from the same variable...

Not unless you're willing to work hard at fudging a number of other things.
ANSI C does insist that the result of sizeof be a compile-time number, and
so it is legitimate to use a sizeof in (e.g.) dimensioning another array.
You can postpone everything to runtime if you really work at it, as witness
the existence of C interpreters, but in a traditional compiled approach,
you really do have to evaluate sizeof at compile time to type-check things
like:

	char *p = sizeof(a) - sizeof(b);

which is legal if and only if the two sizeofs have the same value!
-- 
Imagine life with OS/360 the standard  | Henry Spencer at U of Toronto Zoology
operating system.  Now think about X.  |  henry at zoo.toronto.edu   utzoo!henry



More information about the Comp.std.c mailing list