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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: compile time enforcement of exception specification


Bob Rossi wrote:
> On Sun, Jan 14, 2007 at 12:16:32AM -0500, Andrew Pinski wrote:
>>> Hi,
>>>
>>> Will g++ ever add a compile time enforcement of the exception
>>> specification like the Java compiler does?
>>>
>>> I find the exception specification almost useless with out this
>>> functionality.
>> The C++ standard  ( 15.4/10) is very specific that the implemantion should not
>> reject code just because of exception specification and calling other
>> functions.
> 
> Do you have a link to the standard some where?
> 
> Will g++ not implement compile time enforcement until a standard says
> it's OK to do so? This feature is obviously an improvement over doing
> nothing.

There has been much debate, and a large fraction of those
involved feel that static checking of exceptions in C++ is
*not* an improvement from the current situation.  There
has also been much written on the weaknesses of the Java
approach.

Note: I'm not expressing my personal opinion above on
static vs. dynamic checking.  Just noting that what you
feel is "obviously an improvement" is controversial.

> Wouldn't an option to g++ be only helpful here?

Possibly to some people, but it would also be rather hard
to specify and implement.  Even Java ducked and made many
exceptions unchecked.  My feeling is that there's not much
chance of seeing statically enforced ES in standard C++
anytime soon (not within the next decade, and probably
never), and that its value doesn't match the specification,
design, implementation, testing and documentation costs.

-- James


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