discuss-gnustep
[Top][All Lists]
Advanced

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

Re: #import is obsolete


From: Markus Hitter
Subject: Re: #import is obsolete
Date: Sat, 5 Jul 2003 09:39:24 +0200


Am Samstag, 05.07.03 um 01:03 Uhr schrieb Chris Hanson:

On Friday, July 4, 2003, at 04:25  PM, Philippe C.D. Robert wrote:
#import is deprecated, instead #include should be used in conjunction with include guards. See previous threads about this topic.

The #import directive is *not* deprecated in Objective-C

Have a look what Nicola Pero wrote on July 4th to GNUstep Development:

Be careful with #import as it might be removed completely from the FSF GCC compiler soon. [...] the CVS archive of cpp.texi says it's been obsolete since August 1997. The warning that FSF GCC produces dates to March 2000. So, it's been obsolete for five years, and deprecated with a warning for three. I think that's long enough.

In Apple's Cocoa docs you find #import while there are older compiler Release Notes which tell to fade them out.

and you should *not* switch to #include with include guards;

Why not? #import obviously was an early attempt to make compiles faster (less files to open) but showed more drawbacks than advantages, later. Nowadays headers are precompiled anyway (Apple now, GNU soon). There is no advantage in using #import at all.

The only point in using them is to include headers for single Cocoa classes, since Apple didn't guard them. Common workaround ist to include whole Foundation instead which is faster on the Apple compiler anyway:

#ifndef NeXT_Foundation_LIBRARY
#include <Foundation/NSString.h>
#else
#include <Foundation/Foundation.h>
#endif

Once FSF gcc supports precompiled headers, this might be simplified as well.


Cheers,
Markus

- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter
http://www.jump-ing.de/







reply via email to

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