|
From: | Hungwin Chen |
Subject: | Re: c++ header inclusion |
Date: | Mon, 02 Sep 2013 16:26:24 +0200 |
----- Original Message -----
From: David Chisnall
Sent: 09/02/13 05:36 PM
To: ivan@vucica.net
Subject: Re: c++ header inclusion
On 2 Sep 2013, at 10:31, Ivan Vučica <ivan@vucica.net> wrote: > Wrap the include in: > #if __cplusplus > #endif This should be: #ifdef __cplusplus In [Objective-]C mode, the __cplusplus macro won't be defined, and so the test will error with some compilers. > Although I must point out I don't know enough about mechanisms behind precompiled headers to be certain that the above will work. Consider having two precompiled headers - one for Objective-C, one for Objective-C++. I don't know much about the GCC implementation of PCH (last time I tried using it, it slowed down compilation, although that was gcc 4.1 so it may have improved). For clang, the pch will be ignored if any of the macros that conditions depend on are different, so you will need one for each set of compiler flags you use. Oh, and if you're using Objective-C++ and gcc, then make sure that you don't throw any exceptions... David -- Sent from my IBM 1620
[Prev in Thread] | Current Thread | [Next in Thread] |