This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cpplib: Start moving switch handling to front ends


Zack Weinberg wrote:

On Thu, Aug 08, 2002 at 10:34:11AM -0700, Stan Shebs wrote:

Heh, we tried that argument with our users, but with literally thousands
of headers assuming #import or #pragma once, both internal and external
to Apple, plus an Objective-C book or two recommending the practice,
the response was, shall we say, "negative".  It was pretty clear they
were going to keep firing compiler folks until they found one who was
willing to un-deprecate #import. 1/2 :-)

In the users' defense, it must be said that #import has been working
well on a huge amount of code - in the 2 1/2 years that I've been at
Apple, we've seen dozens of ICEs for instance, but no failures of
#import to find the right file.  So it's not surprising that users
wonder why we're trying to fix something that doesn't seem broken.

Understood.

Apple's in a different boat from FSF GCC - you are only interested in
one platform, and you can make sure that ino/dev comparisons work
properly there.  I suppose I could live with a patch to disable that
warning for Darwin and Objective C only.  However, you could at least
update your own documentation to encourage use of #include and #ifndef
wrappers instead.  You could borrow the rationale from cpp.texi
(I wrote that text; you have my permission to use it)

Even the encouragement of change was enough to get me threatened...
Many longtime NeXT developers believe passionately that #import is
the right way to go, and some even think that it should have been
adopted by the C standard instead of #include (it's not like
#include was mandated on the back of the tablets brought down from
Sinai, after all).

That attitude may change - GNUstep had this debate several months
ago, and decided to switch to #include/#ifndef I think - but I'm
figuring on having to support #import on Macs for several more
years.

There's also a concern about what it means to use both #include and
#import on the same file.  From the manual:

|    In the present implementation, a single use of `#import' will
| prevent the file from ever being read again, by either `#import' or
| `#include'.  You should not rely on this; do not use both `#import'
| and `#include' to refer to the same header file.

Is #pragma once in active use as well as #import?  Neil wanted to
ditch #pragma once.

I'll have to review our uses, but I think it's more of a historical
leftover than a matter of principle. :-)

Stan




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]