RE: //Comments
RE: //Comments
- Subject: RE: //Comments
- From: "Jeff Laing" <email@hidden>
- Date: Tue, 13 Jan 2009 14:46:17 -0700
- Thread-topic: //Comments
> //-comments have been recognized by C compilers, at least as an
> extension, for at least 20 years. Because they'd historically been an
> extension, I suppose the rules have varied subtly. This is what the
> C99 standard (ยง6.4.9) says:
They are also part of the C++ standard going back to its beginning, as far as I recall, so if you have had Objective-C++ enabled, they're allowed as well.
> We'd have to see your specific code, and the error messages, to
> explain why such comments don't always "work" for you. The reason that
> occurs to me is that you've accidentally commented-out part of a
> statement so as to ruin the syntax.
I haven't seen XCode have problems, but some versions of Visual Studio definitely managed to get itself confused if you use // comments inside a macro expansion. ie,
#define MACRO(a,b) something(a,b)
MACRO(
firstarg, // watch the pre-processor go thud
secondarg ) // because of the above comment
The problem being that the // was not being recognised by the PREPROCESSOR as a comment, instead leaving it to the COMPILER to ignore them, but by the time the compiler saw the line, it looked like this for some reason:
something(firstarg //watch the pre-processor go thud, secondarg)
As I say, this was Visual Studio, not XCode. Use the 'preprocess file' command to see what XCode is really passing on to the compiler phase if it continues to be an issue for you.
_______________________________________________
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