• 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: Objective-C or C++ or something...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C or C++ or something...


  • Subject: Re: Objective-C or C++ or something...
  • From: "Alastair J.Houghton" <email@hidden>
  • Date: Thu, 7 Aug 2003 22:29:35 +0100

On Thursday, August 7, 2003, at 09:25 pm, Karl Kuehn wrote:

On Thursday, August 7, 2003, at 03:58 PM, Seth Willits wrote:

My compiler either just started, or I just noticed, complaining if I declare a variable in the middle of a routine. All of the examples I see and the code I have does this, so obviously it's some kind of setting, but I can't find it anywhere. Could someone tell me how to fix this?

Strict C and C++ do not allow this

C++ has allowed declarations in the midst of code for some time (possibly even since its invention, although my experiences of C++ don't stretch that far back). C allows them as of C99. (Both of them, of course, have always allowed declarations at the beginning of a block.)

It's interesting (well I find it so) that so many people use this feature; personally speaking, I don't think it's good style to declare variables in between statements (as opposed to at the beginning of blocks), because it makes finding the declarations of variables really quite difficult (especially if the code isn't well spaced, which a lot of code isn't).

Anyway, Seth's problem is that he's building with GCC 2.95, probably because he installed the new developer tools (either separately or as part of XCode). Project Builder gets confused and runs 2.95 instead of 3.3 or 3.1 unless you explicitly set a load of variables in your target's Expert Settings view (the release notes for the new developer tools say what you have to do; from what I remember, you set GCC_VERSION to 3.3, CC to /usr/bin/gcc-3.3, and CPLUSPLUS to /usr/bin/g++-3.3).

Kind regards,

Alastair.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Objective-C or C++ or something...
      • From: "M. Uli Kusterer" <email@hidden>
    • Re: Objective-C or C++ or something...
      • From: Seth Willits <email@hidden>
References: 
 >Re: Objective-C or C++ or something... (From: Karl Kuehn <email@hidden>)

  • Prev by Date: Re: Objective-C or C++ or something...
  • Next by Date: Re: display windows
  • Previous by thread: Re: Objective-C or C++ or something...
  • Next by thread: Re: Objective-C or C++ or something...
  • Index(es):
    • Date
    • Thread