<br><br><div class="gmail_quote">On Tue, Nov 13, 2012 at 9:15 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Tue, Nov 13, 2012 at 10:51 AM, Matthieu Monrocq<br>
<div class="im"><<a href="mailto:matthieu.monrocq@gmail.com">matthieu.monrocq@gmail.com</a>> wrote:<br>
><br>
><br>
> On Tue, Nov 13, 2012 at 7:44 PM, Konstantin Tokarev <<a href="mailto:annulen@yandex.ru">annulen@yandex.ru</a>><br>
> wrote:<br>
>><br>
>><br>
>> 13.11.2012, 22:39, "Devchandra L Meetei" <<a href="mailto:dlmeetei@gmail.com">dlmeetei@gmail.com</a>>:<br>
>> > Hi all<br>
>> > is the above flag supported.<br>
>><br>
>> No.<br>
>><br>
>> > Will also appreciate if some one can tell best practices to follow while<br>
>> > using clang for reducing size of the resultant binaries?<br>
>><br>
>> -Os -fno-rtti -fno-exceptions<br>
>><br>
>> --<br>
>> Regards,<br>
>> Konstantin<br>
><br>
><br>
> I would note that this not exactly similar:<br>
><br>
> -fno-enforce-eh-specs<br>
>     Don't check for violation of exception specifications at runtime. This<br>
> option violates the C++ standard, but may be useful for reducing code size<br>
> in production builds, much like defining NDEBUG. The compiler will still<br>
> optimize based on the exception specifications.<br>
><br>
> This means that -fno-enforce-eh-specs let's you keep using exceptions.<br>
><br>
><br>
> A better alternative to `throw()` combined with `-fno-enforce-eh-specs` is<br>
> `noexcept` in C++11. If you throw, you are into undefined behavior land<br>
> because there is no runtime check.<br>
<br>
</div>That was true for a while when the 'noexcept' feature was being<br>
designed, but is no longer the case. Just as a 'throw()' exception<br>
specification calls 'std::unexpected' when an exception is thrown, a<br>
'noexcept' exception specification calls 'std::terminate'. See C++11<br>
[except.spec] p9.<br>
</blockquote></div><br>Damned.<br><br>Thanks for the update.<br><br>Do you think it would make sense to implement the `-fno-enforce-eh-specs` flag then ?<br><br>-- Matthieu<br>