Creator of ZeroMQ and AMQP comments on error handling
Tobias Pankrath
tobias at pankrath.net
Mon Jul 16 04:41:30 PDT 2012
On Sunday, 15 July 2012 at 22:27:02 UTC, José Armando García
Sancio wrote:
> On Sun, Jul 15, 2012 at 3:00 PM, Tobias Pankrath
> <tobias at pankrath.net> wrote:
>>> What do you all think?
>>
>>
>> All his arguments about C++ exceptions hold for plain return
>> values, too.
>>
>
> Yes but he would said that is not the point of his article.
I read the article like this:
Exceptions are bad because they spawn "undefined behaviour", thus
I don't want to use exceptions. However if I try that in a
language that is designed to use exceptions, i'll run into
problems.
And my thoughts about this are: The problems he seems to have
with exceptions are more or less the same with error codes. So
I'd say the premise of this article is wrong and the conclusion
useless. But what if exception where really much worse than error
codes and you want to avoid them in C++?
Yeah .. you get the same problems than in C, i.e. split
initialization. So whatever happens you not worse of than in C.
And "what if developer puts code in here that my throw although
he must not?" is more or less equivalent then: "What if the
developer ignores all error codes ..?"
You need to play by the rules and you can't force people to do
this (Java proofed this). What you need to do is to make
following rules easier than breaking.
More information about the Digitalmars-d
mailing list