On Dec 2, 2009, at 6:19 PM, Mike Stump wrote:

> On Dec 2, 2009, at 6:14 PM, Ted Kremenek wrote:
>> Indeed.  For those we can have separate has_feature entries.
> 
> And is a portable header suposed to do this:
> 
> #ifdef __cplusplus
> #if __has_feature(cxx_exceptions)
> #define HAVE_EXCEPTIONS
> #endif
> #else
> #if __has_feature(c_exceptions)
> #define HAVE_EXCEPTIONS
> #endif

Well, you could also just do:

#if __has_feature(cxx_exceptions) || __has_feature(c_exceptions)

However, what is the use case of this?  If a header is supposed to work in both 
C and C++, it has to be in the common subset of both, which means it is C, and 
then the flag really only makes sense to provide unwind info for functions that 
could be thrown through.  What would you possibly user scenario would care 
about C exceptions?

A concrete use case for C++ exceptions is to make the std::vector::at method 
vanish if building with EH disabled, for example.

-Chris


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to