[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: c++ header inclusion
From: |
David Chisnall |
Subject: |
Re: c++ header inclusion |
Date: |
Mon, 2 Sep 2013 10:36:41 +0100 |
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