This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: patch: <bits/localefwd.h> with -fno-exceptions



I'm strongly against having the compiler silently ignore/transform
try/catch when we see -fno-exceptions.

That is different behavior from what most other vendors have chosen,
it increases complexity in the front-end, and it's potentially very
confusing to users, since code that *depends* on real exceptions
occurring will silently break.  (Issuing a warning really isn't good
enough; too many people don't look at them.)

If we do this at all, we should have a -ftransform-exceptions switch
that is *different* from -fno-exceptions; there are already
expectations in place about what -fno-exceptions means.

But, I would recommend against such a switch.  It's just a fact of
life in C++ that if you want to go to an exception-free model, you
have to macroize your code somewhat heavily.  If you have code that is
designed for an embedded system, and you don't want to use exceptions,
you have to design that into the code -- just as you would design
real-time capability, or a data format that used less memory at the
cost of more time, or I/O routines that could be easily retargeted at
different I/O models, or ...

We should resist the temptation we've had way too many times to try to
solve these kinds of problems in the compiler -- the language is what
it is, IMO.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]