Issue 1937: Signature of _narrow in exceptions (cxx_revision) Source: (, ) Nature: Uncategorized Issue Severity: Summary: Summary: The mapping shows the signature for the _narrow static member functions in exceptions as static SystemException * _narrow(Exception *); I think we should change this to static SystemException * _narrow(const Exception *); Otherwise, I cannot catch an exception as const and then narrow it without a cast. Resolution: Revised Text: Actions taken: September 7, 1998: received issue February 22, 1999: closed issue Discussion: End of Annotations:===== Return-Path: X-Authentication-Warning: tigger.dstc.edu.au: michi owned process doing -bs Date: Mon, 7 Sep 1998 12:36:56 +1000 (EST) From: Michi Henning To: issues@omg.org, cxx_revision@omg.org Subject: Signature of _narrow in exceptions The mapping shows the signature for the _narrow static member functions in exceptions as static SystemException * _narrow(Exception *); I think we should change this to static SystemException * _narrow(const Exception *); Otherwise, I cannot catch an exception as const and then narrow it without a cast. Cheers, Michi. Return-Path: X-Sender: vinoski@mail.boston.iona.ie Date: Sun, 20 Sep 1998 00:05:41 -0400 To: Michi Henning From: Steve Vinoski Subject: Re: Signature of _narrow in exceptions Cc: cxx_revision@omg.org At 12:36 PM 9/7/98 +1000, Michi Henning wrote: >The mapping shows the signature for the _narrow static member >functions in exceptions as > > static SystemException * _narrow(Exception *); > >I think we should change this to > > static SystemException * _narrow(const Exception *); > >Otherwise, I cannot catch an exception as const and then narrow it >without a cast. Actually, you would need to overload it: static const SystemException* _narrow(const SystemException*); Otherwise, you would essentially be casting away constness. --steve Return-Path: X-Sender: vinoski@mail.boston.iona.ie Date: Sun, 20 Sep 1998 11:38:40 -0400 To: cxx_revision@omg.org From: Steve Vinoski Subject: Re: Signature of _narrow in exceptions References: At 12:05 AM 9/20/98 -0400, Steve Vinoski wrote: >Actually, you would need to overload it: > >static const SystemException* _narrow(const SystemException*); > >Otherwise, you would essentially be casting away constness. As Javier Lopez-Martin has kindly pointed out to me, what I meant was: static const SystemException* _narrow(const Exception*); Thanks, Javier! --steve Return-Path: X-Sender: vinoski@mail.boston.iona.ie Date: Wed, 07 Oct 1998 21:38:02 -0400 To: cxx_revision@omg.org From: Steve Vinoski Subject: Re: Semantics of _narrow on valuetypes References: <199810071237.IAA12826@boston.iona.ie> Closely related to Jon's narrow/downcast issue is Michi's issue concerning downcast of const Exception* (issue 1937). While this is not an issue for valuetypes because they are never handled in the mapping by pointer to const, I think it is an obvious problem with exceptions, and luckily, an easy one to solve. If the RTF allows, and if Jon approves, I'd like to tack an addition onto Jon's proposal to solve this problem. All that is required to solve issue 1937 is the addition of an overloaded _downcast function for exceptions, where "T" is the exception type: static T* _downcast(T* exception); // already specified in Jon's proposal static const T* _downcast(const T* exception); // added overloaded version If Jon and the rest of you approve of this modification to the proposal, and you have already voted, please only vote again if you want to change your vote. If Jon or any other voting C/C++ RTF member objects, however, then the proposal reverts to exactly what Jon posted earlier today, and the voting in progress continues as if I never attempted this addition. --steve Date: Sun, 21 Feb 1999 11:05:25 +1000 (EST) From: Michi Henning To: C++ Revision Task Force Subject: Issue 1937 Organization: Triodia Technologies Mark 1937 as closed -- it was fixed in the 1.4 revision. Cheers, Michi. -- Michi Henning +61 7 3236 1633 Triodia Technologies +61 4 1118 2700 (mobile) PO Box 372 +61 7 3211 0047 (fax) Annerley 4103 michi@triodia.com AUSTRALIA http://www.triodia.com/staff/michi-henning.html