public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64482] No Exceptions Improvements
  2015-01-03 18:16 [Bug c++/64482] New: No Exceptions Improvements olafvdspek at gmail dot com
@ 2015-01-03 18:16 ` olafvdspek at gmail dot com
  2015-01-04 13:54 ` redi at gcc dot gnu.org
  2015-01-04 14:25 ` glisse at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: olafvdspek at gmail dot com @ 2015-01-03 18:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64482

Olaf van der Spek <olafvdspek at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/64482] New: No Exceptions Improvements
@ 2015-01-03 18:16 olafvdspek at gmail dot com
  2015-01-03 18:16 ` [Bug c++/64482] " olafvdspek at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: olafvdspek at gmail dot com @ 2015-01-03 18:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64482

            Bug ID: 64482
           Summary: No Exceptions Improvements
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: olafvdspek at gmail dot com

Currently -fno-exceptions is partially implemented in the std library. throw is
replaced by abort(), try and catch are basically no-ops. However, user code
doesn't benefit from this.
Could these things be implemented in the compiler instead?

Ideally a throw would still result in something like:
terminate called after throwing an instance of 'std::runtime_error'
  what():  Bah
Aborted

https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_exceptions.html

#include <stdexcept>

int main()
{
    throw std::runtime_error("Bah");
}


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/64482] No Exceptions Improvements
  2015-01-03 18:16 [Bug c++/64482] New: No Exceptions Improvements olafvdspek at gmail dot com
  2015-01-03 18:16 ` [Bug c++/64482] " olafvdspek at gmail dot com
@ 2015-01-04 13:54 ` redi at gcc dot gnu.org
  2015-01-04 14:25 ` glisse at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2015-01-04 13:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64482

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Olaf van der Spek from comment #0)
> Currently -fno-exceptions is partially implemented in the std library.

That's not really accurate, it is implemented entirely in the compiler, but the
library contains workarounds to support using it with -fno-exceptions.

Currently, user code that wants to support -fno-exceptions needs to provide its
own similar workarounds. That can be done by checking the __cpp_exceptions
feature-test macro (or __EXCEPTIONS for older releases).

IMHO it doesn't really make sense to expect to use 'throw' when exceptions are
disabled.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/64482] No Exceptions Improvements
  2015-01-03 18:16 [Bug c++/64482] New: No Exceptions Improvements olafvdspek at gmail dot com
  2015-01-03 18:16 ` [Bug c++/64482] " olafvdspek at gmail dot com
  2015-01-04 13:54 ` redi at gcc dot gnu.org
@ 2015-01-04 14:25 ` glisse at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: glisse at gcc dot gnu.org @ 2015-01-04 14:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64482

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #1)
> Currently, user code that wants to support -fno-exceptions needs to provide
> its own similar workarounds. That can be done by checking the
> __cpp_exceptions feature-test macro (or __EXCEPTIONS for older releases).

There is an argument for providing a feature in gcc when enough users are
likely to use it, so they don't have to reinvent a triangular wheel.

> IMHO it doesn't really make sense to expect to use 'throw' when exceptions
> are disabled.

You may want to use a third-party library that only uses throw for error
reporting, where you are fine with aborting. IMHO, a way to automatically turn
throw into abort/terminate would be a nice complement for -fno-exceptions (it
can be a separate option, that doesn't really matter).


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-04 14:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-03 18:16 [Bug c++/64482] New: No Exceptions Improvements olafvdspek at gmail dot com
2015-01-03 18:16 ` [Bug c++/64482] " olafvdspek at gmail dot com
2015-01-04 13:54 ` redi at gcc dot gnu.org
2015-01-04 14:25 ` glisse at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).