• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: #define bug in gcc for delta builds?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: #define bug in gcc for delta builds?
      • From: Steve Checkoway <email@hidden>
References: 
 >#define bug in gcc for delta builds? (From: Stephen Northcott <email@hidden>)
 >Re: #define bug in gcc for delta builds? (From: Andreas Grosam <email@hidden>)
 >Re: #define bug in gcc for delta builds? (From: Stephen Northcott <email@hidden>)

  • Prev by Date: Re: #define bug in gcc for delta builds?
  • Next by Date: Re: #define bug in gcc for delta builds?
  • Previous by thread: Re: #define bug in gcc for delta builds?
  • Next by thread: Re: #define bug in gcc for delta builds?
  • Index(es):
    • Date
    • Thread