Return to the archive index

Re: Memory allocation questions

To: Ken.Yap@cmis.csiro.au
Cc: linux-8086@vger.rutgers.edu
From: Perry Harrington <pedward@sun4.apsoft.com>
Date: 	Mon, 14 Jul 1997 22:28:26 -0700 (PDT)
Newsgroups: linux.dev.8086

Broken down to the bare minimum, compilers are 4 steps.  In reality there
are many detailed steps.  The dragon book is a very good book on this
subject.  The fact remains that the compiler must replace the "sizeof" with
the actual size of the structure.  That happens before any parsing of the
final code and analysis is done.  The compiler has to differentiate between
a compiler centric use of sizeof and the "C" library call.  My opinion is
that sizeof should only be used in a static sense, using it in a dynamic
sense is not always guaranteed and is bad form.

--Perry

> 
> >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.
> 
> Compilers differ in internal structure. There is no requirement in C
> for any particular structure or even such a beast as a "compiler
> preprocessor". However generally the stages are: lexical analysis,
> parsing, semantic analysis, and code generation.
> 

-- 
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