To: Ken.Yap@cmis.csiro.au Cc: linux-8086@vger.rutgers.edu From: Perry Harrington <pedward@sun4.apsoft.com> Date: Mon, 14 Jul 1997 16:20:34 -0700 (PDT) Newsgroups: linux.dev.8086 I said *compiler preprocessor*, not C preprocessor, the difference being that the C preprocessor just does macro expansion, the Compiler usually runs in stages, the data items are grabbed before the code is parsed. The sizeof command is preprocessed before the statements are evaluated. The Compiler takes the code and does what I said. I seem to recall the compiler trivia from long ago, it may no longer be valid. --Perry > > > /* now, the "sizeof" command is a compiler preprocessor usually, > > it looks in it's symbol table for the size of the > > data item and replaces the call with a constant, this > > works because structs can't be declared at runtime. > > Now, Microsoft and Borland diverge on this point, > > Borland treats it as a compiler command, and Microsoft > > allows it to be used to determine the size of a chunk > > of memory, which technically AFAIK is incorrect */ > > > > ptr=malloc(sizeof(struct foo)); > > Not true. The C preprocessor doesn't know anything about sizeof because > it doesn't know anything about data structures. The C preprocessor only > deals with # lines and substitution of macro names. I'm not sure what > you mean by the alleged difference between Borland and MS compilers. > -- Perry Harrington Linux rules all OSes. APSoft () email: perry@apsoft.com Think Blue. /\
From Unofficial Linux-8086 Mailing List Archive (ULMLA)
Maintained by Robert
Robert's Mailing List Archive Page
Archive created with babymail