🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1791

Re: X3J11 Pleasanton meeting summary

#1791
From: Henry Spencer
Date: Sat, 06 Oct 1990 03:32
20 lines
1519 bytes
In article <12672@ogicse.ogi.edu> daniels@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@zoo.toronto.edu   utzoo!henry
Technical Details
Message-ID: <1990Oct6.033209.10055@zoo.toronto.edu>
Path: arc1-ca.pugleaf.net!utzoo!henry
References: <13996@smoke.BRL.MIL> <3206@mcrware.UUCP> <470@taumet.com> <1990Oct5.173314.28454@zoo.toronto.edu> <12672@ogicse.ogi.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!utzoo!henry
From: henry@zoo.toronto.edu (Henry Spencer)
Subject: Re: X3J11 Pleasanton meeting summary
Message-ID: <1990Oct6.033209.10055@zoo.toronto.edu>
Organization: U of Toronto Zoology
References: <13996@smoke.BRL.MIL> <3206@mcrware.UUCP> <470@taumet.com> <1990Oct5.173314.28454@zoo.toronto.edu> <12672@ogicse.ogi.edu>
Date: Sat, 6 Oct 90 03:32:09 GMT