Topic: missing description : error_category's destructor


Author: Akira Takahashi <faithandbrave@gmail.com>
Date: Mon, 19 Mar 2012 23:22:55 -0700 (PDT)
Raw View
Hi,

I found missing description. N3337 19.5.1.1 error_category:
virtual ~error_category() noexcept;

This function is nothing description.

Correct code is follow?
virtual ~error_category() noexcept = default;

Thanks,
Akira


--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]




Author: =?ISO-8859-1?Q?Daniel_Kr=FCgler?=<daniel.kruegler@googlemail.com>
Date: Wed, 21 Mar 2012 08:42:17 -0700 (PDT)
Raw View
On 2012-03-20 07:22, Akira Takahashi wrote:
>  I found missing description. N3337 19.5.1.1 error_category:
>  virtual ~error_category() noexcept;
>
>  This function is nothing description.

I agree, because a virtual destructor is not covered by the general
statement in [functions.within.classes] p1.

>  Correct code is follow?
>  virtual ~error_category() noexcept = default;

Except for the explicit noexcept specification, yes. There is a general
normative statement in [res.on.exception.handling] p4

"Every destructor in the C++ standard library shall behave as if it had
a non-throwing exception specification."

which rules this already. This is the reason why *no* destructor
declaration in the library specification does have any noexcept
specification. Adding this suddenly at one place would make give the
impression that we have a special case here.

HTH&  Greetings from Bremen,

Daniel Kr   gler



--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]




Author: Akira Takahashi<faithandbrave@gmail.com>
Date: Wed, 21 Mar 2012 11:36:15 -0700 (PDT)
Raw View
>  >    I found missing description. N3337 19.5.1.1 error_category:
>  >    virtual ~error_category() noexcept;
>
>  >    This function is nothing description.
>
>  I agree, because a virtual destructor is not covered by the general
>  statement in [functions.within.classes] p1.
>
>  >    Correct code is follow?
>  >    virtual ~error_category() noexcept = default;
>
>  Except for the explicit noexcept specification, yes. There is a general
>  normative statement in [res.on.exception.handling] p4
>
>  "Every destructor in the C++ standard library shall behave as if it had
>  a non-throwing exception specification."
>
>  which rules this already. This is the reason why *no* destructor
>  declaration in the library specification does have any noexcept
>  specification. Adding this suddenly at one place would make give the
>  impression that we have a special case here.
>
>  HTH&    Greetings from Bremen,
>
>  Daniel Kr   gler
>

Oh, your right.
I get new knowledge. Thanks.

Summary, should change:

virtual ~error_category() = default;

or add description:

"Effects: Destroys an object of class error_category."

Thanks,
Akira


--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]