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: Stephen Northcott <email@hidden>
- Date: Wed, 4 Feb 2009 18:07:34 +0700
Hi Stephen,
honestly, I suspect there is something wrong with your code. It
seems you are not 100% familiar with the C++ concepts.
Really? How so?
I have been using #define _FOO_ to conditionally alter the
compilation of parts of a class.
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.
In the related .cpp file I would use the same value _FOO_ to
control how code behaved with regards accessing A, or A and B.
If we assume that _FOO_ is not defined then...
When stepping through in XCode
I'm assuming you are stepping through *your* code using Xcode's
debugger ...
Yes.
I noticed that when the class instance is created
to be precise, you only create instances of a certain class, not
"class instances".
Pardon? I shall turn in my UK passport immediately!
it will be created according to _FOO_ being defined, when it is
actually not defined as I stated just above.
that's confusing me. How do you test whether _FOO_ is defined or
not. If you are unsure, just insert a
#error blah
directive in your .cpp file and compile it.
Where is _FOO_ actually defined anyway, and how?
Ok. I give up with the rest..
Thanks anyway.
_______________________________________________
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