Topic: [Q] Exception specifiers on member functions in scope
Author: mishad@iplbath.demon.co.uk (Misha Dorman)
Date: Tue, 30 Nov 1993 11:51:54 +0000 Raw View
In article <rfgCH87qJ.3sy@netcom.com> rfg@netcom.com writes:
>OK. But what exactly is "the definition of a member function". Does that
>include the formal parameter list??
>
>I have to believe that the answer is NO because given:
ARM 10.4:
"a function argument name in a function DEFINITION is in the scope
of the outermost block of the function" (my caps)
I would take this to mean that the formal argument list of a function
DEFINITION (not declaration) is in the scope of the outermost block of the
function, and thus in the scope of the class.
What I want is a similar statement about exception specifiers.
Note that for member functions, the only declarations are within the
class definition (and thus certainly in its scope), so the rule about
definitions covers any out-of-line member defintion.
[ ARM 9.3 (p.174):
"Members may be defined outside their class definition ... but may
not be redeclared"
]
My assumption is that an exception-specification is akin to a formal
parameter list, wrt scoping. Just to show that it ain't necessarily so,
the ARM has the following to say about constructor initialisations:
ARM 10.4 (p.217)
"a ctor-initializer is evaluated in the scope of the outermost block
of the constructor it is specified for ... it can refer to the ...
arguments
COMMENTARY: Note however that the base calss and member names are
looked up in the scope of the class itself"
So we can't just assume that everything from the CLASS::member to the end of
the declaration is in the scope of the outermost block. However, all of
it seems to be specified as being in the scope of the class in one way or
another.
Any more thoughts, anyone?!
Author: rfg@netcom.com (Ronald F. Guilmette)
Date: Wed, 1 Dec 1993 09:51:38 GMT Raw View
In article <754660314snz@iplbath.demon.co.uk> mishad@iplbath.demon.co.uk writes:
>In article <rfgCH87qJ.3sy@netcom.com> rfg@netcom.com writes:
>
>>OK. But what exactly is "the definition of a member function". Does that
>>include the formal parameter list??
>>
>>I have to believe that the answer is NO because given... [text deleted]
>
>ARM 10.4:
> "a function argument name in a function DEFINITION is in the scope
> of the outermost block of the function" (my caps)
>
>I would take this to mean that the formal argument list of a function
>DEFINITION (not declaration) is in the scope of the outermost block of the
>function, and thus in the scope of the class.
Nope, but nice try. Those are two different scopes. If something is "in"
function scope, then (by definition) it is NOT "in" class scope.
(It's all well and good to try to eke some rational out of the ARM for what
we believe *must* be the case... i.e. that exception specifications are a
part of the function's scope... but you can't do it via this line of reason-
ing. Best look for another route.)
--
-- Ronald F. Guilmette, Sunnyvale, California -------------------------------
------ domain address: rfg@netcom.com ---------------------------------------
------ uucp address: ...!uunet!netcom.com!rfg -------------------------------