Re: #define bug in gcc for delta builds?
Re: #define bug in gcc for delta builds?
- Subject: Re: #define bug in gcc for delta builds?
- From: Matt Gough <email@hidden>
- Date: Wed, 4 Feb 2009 12:28:40 +0100
On 4 Feb 2009, at 12:07, Stephen Northcott wrote:
In the .h file I had something like this..
#ifdef _FOO_
int A = 2;
#else
int A = 2;
int B = -1;
#endif // _FOO_
Well, this code is quite unusual - maybe for testing purposes
only. A side note: basically, do not use names for macros that
begin with an underscore.
It's a simple example, not the actual code!!
Perhaps you'd like 1000+ lines of actual source?
So, it should also be clear, what this code means: here you define
variables in global namespace - aka "globals" with external
linkage. This means, you can access these objects from any other
translation unit. These are the "infamous" globals.
Yes. Exactly as I want them to be.
Its been a while, so I could be wrong, but:
if you declare globals this way, aren't they unique to each
compilation unit?
i.e if bar.cpp and roo.cpp both #include foo.h then they both refer to
globals called A but they are in different locations (and hence not
the same A)
Is this what you want?
Matt
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden