[cfe-dev] Does clang support -fno-enforce-eh-specs option of gcc

Devchandra L Meetei dlmeetei at gmail.com
Tue Nov 13 11:04:13 PST 2012


Thanks All

Warm regards
--Dev


On Wed, Nov 14, 2012 at 12:21 AM, Matthieu Monrocq <
matthieu.monrocq at gmail.com> wrote:

>
>
> On Tue, Nov 13, 2012 at 7:44 PM, Konstantin Tokarev <annulen at yandex.ru>wrote:
>
>>
>> 13.11.2012, 22:39, "Devchandra L Meetei" <dlmeetei at gmail.com>:
>> > Hi all
>> > is the above flag supported.
>>
>> No.
>>
>> > Will also appreciate if some one can tell best practices to follow
>> while using clang for reducing size of the resultant binaries?
>>
>> -Os -fno-rtti -fno-exceptions
>>
>> --
>> Regards,
>> Konstantin
>>
>
> I would note that this not exactly similar:
>
> -fno-enforce-eh-specs
>     Don't check for violation of exception specifications at runtime. This
> option violates the C++ standard, but may be useful for reducing code size
> in production builds, much like defining NDEBUG. The compiler will still
> optimize based on the exception specifications.
>
> This means that -fno-enforce-eh-specs let's you keep using exceptions.
>
>
> A better alternative to `throw()` combined with `-fno-enforce-eh-specs` is
> `noexcept` in C++11. If you throw, you are into undefined behavior land
> because there is no runtime check.
>
> I do not think there are similar alternatives when the exception
> specification did precise a list of exceptions, but those are much rarer.
>
> -- Matthieu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121114/530ed6c4/attachment.html>


More information about the cfe-dev mailing list