discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: import vs include Re: Porting autogsdoc to OSX


From: Nicola Pero
Subject: Re: import vs include Re: Porting autogsdoc to OSX
Date: Wed, 27 Feb 2002 18:18:08 +0000 (GMT)

> >> what (if anything) we should do about that.  Presumably if someone 
> >> wants
> >> to write code for MacOS-X they would use import in their code.
> >
> > I think they have to as #include breaks on OSX (which is where this
> > thread started isnt it ?)
> >
> > Regardless of the theorietical "correctness" the fact remains
> > that if you want portable code which run on GNUstep, OSX, OpenStep
> > and YellowBOX/NT you use #import for the external headers. You should
> > make sure your own headers are properly protecetd against #include 
> > though, as should any GNUstep headers. If #import goes away in future then 
> > you
> > just need to do a global substitute to port the code.

Well - this long thread had a good effect at least I hope - that now
everyone knows everything about #include vs #import :-)

I hope Marcus has no doubts left. :-)

I'm writing this last email just because I don't want people to have the
impression GNUstep is hostile to #import just because I took part in a
flamewar against it :-)

As it was said countless times, GNUstep headers are protected against
multiple inclusions.  You can #import or #include them as you wish.  So if
you want to use #import (for portability reason to MacOSX or for other
reasons) you of course can.

We even automatically add the -Wno-import flag to the GCC compiler in
gnustep-make - to hide the GCC warnings if you use #import - the GCC
standard distribution seriously complains when it finds #import otherwise.

I would personally really love to see that default flag go away - but I
understand that some people have their reasons for using #import, and I
respect that - so the flag is going to remain, and you get no warnings
when using #import.

While I do take part in flamewars :-) I think the actual code should
remain as most friendly as possible to all users, even those damn Apple
coders who are using such an obsolete archaic relict of a decade ago like
#import :-), so we're keeping this -Wno-import flag by default. :-)

GNUstep internally uses #include.  While every user can do what they want
with their code, GNUstep internally uses #include and that is not going to
change.  I think the original question by Marcus was why GNUstep prefers
#include.  I hope it was answered :-)

And yes - even if you use #import - please try to always protect your
headers against multiple inclusions.

Finally, I don't think the autogsdoc example is particularly relevant ...
it was meant to be an internal GNUstep base tool, and only recently
Richard changed his mind :-) and thought it would be good to port it to
MacOSX.  So it's not particularly surprising that it depends on a lot of
specific gnustep base APIs and gnustep base stuff.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]