[Top][All Lists]

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

Re: Legacy applications and headers

From: Markus Hitter
Subject: Re: Legacy applications and headers
Date: Fri, 19 Mar 2004 19:36:13 +0100

Am 19.03.2004 um 16:40 schrieb David Ayers:

Marcus Müller wrote:

I found out that GDL2 often uses constructs like the following in its headers:
#ifndef NeXT_Foundation_LIBRARY
#include <Foundation/NSArray.h>

To verify, I just created an empty "Foundation Tool" in Xcode (Mac OS X 10.3.3) and NeXT_Foundation_LIBRARY indeed appears to be undefined, right after the #import of Foundation/Foundation.h. Tried the same in ProjectBuilder on OS X 10.1.5 and it isn't defined either.

To investigate further, I added an #import <Foundation/NSArray.h> and #include <Foundation/NSArray.h> to both. Still, everything works fine. No errors no warnings ...

(For completeness' sake, in the example above, without the manual definition of NeXT_Foundation_LIBRARY the build will fail on MacOSX due to redefinitions of NSArray and the like.)

... so I'm not sure how this happens. You always should be able to include/import a header as often as you like.

Might be some trouble with the precompiled header mechanism. See Scott Tookers posting on Oct 27 2003 on Apple's Xcode Users list:

It sounds like the problem you are running into is that we are not detecting when we need to rebuild the precomp header (which we have made improvements on for the next release).
 - this might apply here or not, I don't know. -

I believe the test was intended to insure ... that we only wanted to use the precompiled headers for Apple's Foundation

It's quite possible this didn't work all the time ...

Maybe there is another marker we could use?

since you get 95 % of the compilation speed increase by using the precompiled header at all we could drop the entire test. Some redundant #include's don't matter[1].

If you want to keep the test, since even non-Apple gcc will use precompiled headers soon, there should be some platform independent test.


[1] The reason is simple: Usually, headers begin with something like:


Since this flag is defined in the precompiled header already, the entire file contents is dropped. Left is the exercise to scan the file for the corresponding #endif.

See my posting on Jan 1 2003 on GNUstep Discuss for verification.

reply via email to

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