bug or problem with gcc and include files

Nils Philippsen nphilipp at redhat.com
Thu Mar 25 15:38:12 UTC 2004


On Thu, 2004-03-25 at 16:30, Robert Marcano wrote:
> On Thu, 2004-03-25 at 11:14, Steve Wampler wrote:
> > On Thu, 2004-03-25 at 06:59, jludwig wrote:
> > > If include is a preprocessor directive how can it be in the body of a
> > > function?
> > 
> > Uh, how can it not be ok there?  The preprocessor doesn't know
> > anything about function bodies - it's just processing text, not
> > C code.
> > 
> > In fact, you can do some amazing things with the preprocessor,
> > most of which shouldn't be done.
> 
> A good example of this is located at
> http://lxr.mozilla.org/security/source/security/nss/lib/softoken/pkcs11.c#110
> 
> this #include allows this code to define a function pointers structure
> with the same function definitions previously included

Nevertheless, usually headers need to be "aware" of being included at
random places. Most system headers aren't.

Nils
-- 
     Nils Philippsen    /    Red Hat    /    nphilipp at redhat.com
"They that can give up essential liberty to obtain a little temporary
 safety deserve neither liberty nor safety."     -- B. Franklin, 1759
 PGP fingerprint:  C4A8 9474 5C4C ADE3 2B8F  656D 47D8 9B65 6951 3011





More information about the fedora-list mailing list