Re: Objective-C or C++ or something...
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.