|
Boost : |
Subject: Re: [boost] [system][filesystem v3] Question abouterror_code arguments
From: David Bergman (David.Bergman_at_[hidden])
Date: 2009-10-27 13:49:45
On Oct 27, 2009, at 1:43 PM, Andrey Semashev wrote:
> David Bergman wrote:
>> On Oct 27, 2009, at 12:50 PM, Peter Foelsche wrote:
>>>> Others noted embedded environments -- very important today -- but
>>>> let's look at a broader case.
>>>
>>> I was talking about C++.
>>> C++ includes exception handling.
>>> C++ without exception handling does not make any sense,
>>> as one cannot perform a fallible resource allocation inside a
>>> constructor.
>> There is no official recommendation for the language in-between EC+
>> + and C++ - C++ minus exception handling - AFAIK, but it is no
>> secret that Boost is targeting that "language" as well, and also C+
>> +/CLI to some extent.
>> Strange as it might seem, quite sensical programs have been created
>> in this unnamed language, even though one cannot use the sometimes
>> nifty feature of throwing in a constructor. So, I fail to see how
>> it "does not make any sense."
>
> I don't want to comment the ASIO-related argument, neither I want to
> convert anyone to anything.
>
> What I want to point out is that IMO, exceptions are sometimes
> undeservedly ignored for different reasons. One of such reasons is
> developer's commons, if he got used to code without exceptions and/
> or cannot use them properly for the lack of knowledge. Another
> reason is attempt to achieve overzealous portability, be that
> ancient buggy compilers from the dawn of C++ or some exotic
> platforms without exceptions support. All these reasons are valid,
> at least for now.
>
> But for how long? Developers eventually learn things or move to
> other languages (C?). Ancient compilers die, new ones become more
> popular and more efficient. Exotic platforms also either tend to
> decease or evolve. In my mind, error handling through exceptions
> should become more preferred over time. Expressing and honoring this
> tendency in the Standard for the coming 5 years may not be such a
> bad idea after all.
I agree with all you said, but (i) one should understand the *current*
need for exception-less solutions and (ii) the idea that (C++) code
without exception constructs is in some sense nonsensical is, well,
nonsensical ;-) - all this while striving for exception handling
everywhere possible and try to push compiler writers to make such
handling even more efficient.
/David
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk