Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What compile options of clang change their default between Objective C and Objective C++?

I was reading the clang documentation on reference counting, which says that “ By default in Objective-C, ARC is not exception-safe”. It proceeds to say:

A program may be compiled with the option -fobjc-arc-exceptions in order to enable these, or with the option -fno-objc-arc-exceptions to explicitly disable them, with the last such argument “winning”. In Objective-C++, -fobjc-arc-exceptions is enabled by default.

I was intrigued. Are there any other compiler options whose default change between Objective-C and Objective-C++?

Complementary question: what is difference between compiling purely Objective-C code with clang in Objective-C++ mode (*.mm files) rather than in Objective-C mode only (*.m)?

like image 708
Jean-Philippe Pellet Avatar asked Sep 10 '25 15:09

Jean-Philippe Pellet


1 Answers

Best way is to log what clang will output from all those c language

here's some of what i have got from a obj-c++ compilation

clang++ -fobjc-arc main.mm -v

/.../
-fblocks 
-fobjc-runtime=macosx-10.7.0 
-fobjc-dispatch-method=mixed 
-fobjc-default-synthesize-properties 
-fobjc-arc 
-fobjc-arc-cxxlib=libstdc++ 
-fobjc-arc-exceptions 
-fobjc-exceptions 
-fcxx-exceptions 
-fexceptions 
-fdiagnostics-show-option 
-fcolor-diagnostics 
   /.../

As you can see those output can vary depending from where you compile it. But some of them are constants.

You should try on different c families files in order to determine what the default option are for these respective.

Hope it will help you.

like image 185
Mr Bonjour Avatar answered Sep 13 '25 05:09

Mr Bonjour