PDA

View Full Version : Disabling C++ named operators in Xcode


c0d1f1ed
2006.09.20, 03:29 PM
Hi all,

I'm new to Mac development and I'm trying to port a Windows application. It uses lots of names that have, fairly recently, become C++ keywords, namely 'and', 'or', 'not', etc. Changing all the code is no option. Is there any way to disable this C++ extension in Xcode?

I know it's the -fno-operator-names option in GCC, but I haven't found how to configure Xcode with it. All help will be greatly appreciated.

Thanks,

c0d1f1ed

Taxxodium
2006.09.20, 03:51 PM
What's wrong with Find & Replace?

ThemsAllTook
2006.09.20, 03:58 PM
I believe there's an "Other Compiler Flags" field in the project/target settings window which would be the correct place for that.

c0d1f1ed
2006.09.20, 04:42 PM
What's wrong with Find & Replace?
A couple things. It's not all my code, so I'd like to avoid forcing other people to do a find & replace on all affected code. Also, the variable names are very logical at the moment, so appending an underscore or anything else would be plain ugly. Furthermore, I've succesfully used -fno-operator-names on other platforms, so it would definitely be nice to use the same solution on Mac. Cheers.

Edit: Last but not least, in my opinion this is one of the worst C++ extensions. Introducing new keywords is never a good idea, and in this case they even serve no purpose. So I'd like to disable this no matter what. But that's just me...

c0d1f1ed
2006.09.20, 04:44 PM
I believe there's an "Other Compiler Flags" field in the project/target settings window which would be the correct place for that.
I found a 'Other Linker Flags' field, but no compiler related field...

ThemsAllTook
2006.09.20, 04:51 PM
I found a 'Other Linker Flags' field, but no compiler related field...
Sorry, I guess that's not the name of it. I just checked in Xcode, and it looks like "Other C++ Flags" is the setting you want.

akb825
2006.09.20, 05:19 PM
Put it under the field named "Other C++ flags."

c0d1f1ed
2006.09.20, 05:39 PM
Found it! Instead of 'Edit Project Settings' I needed 'Edit Active Target '*''. :blush:

Thanks all!