Article View: comp.std.c++
Article #688ARM Specs Contradiction
From: Arthur Sombrito
Date: Thu, 08 Oct 1992 12:36
Date: Thu, 08 Oct 1992 12:36
40 lines
1864 bytes
1864 bytes
--
There seems to be a contradiction in ARM specifications regarding
friend function declarations. In p. 250, it is stated that A:"If a
class or a function mentioned as a friend has not been declared
its name is entered in the same scope as the name of the class
containing the friend declaration. In p. 251, it is stated that
B:"A function first declared in a friend declaration is equivalent
to an extern declaration." Which is the correct spec: a friend
function is entered in the same scope or it is entered in file scope?
Given the ff. example w/c is similar to the one in p. 188:
class B {
class C {
friend f();
};
};
Following spec A, it would have created a B::f() member function.
I would therefore assume that spec A is applicable only to classes.
Following that assumption, it would also mean that the usual scope
resolution rules are not followed for friend functions. For example:
f();
class A { f(); };
class B {
f();
class C : public A {
friend f();
};
};
Under normal scoping rules, the sequence would have been A::f(), B::f()
and ::f(). But in this circumstances, ::f() would always be the only
function visible to the friend declaration. A::f() and B::f() could only
be made friends by adding the class qualifiers.
Comments would be greatly appreciated.
Technical Details
Message-ID:
<1992Oct8.123635.10160@nuscc.nus.sg>Path:
arc1-ca.pugleaf.net!sparky!uunet!portal!lll-winken!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!wupost!tulane!darwin.sura.net!jvnc.net!nuscc!arthurShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!portal!lll-winken!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!wupost!tulane!darwin.sura.net!jvnc.net!nuscc!arthur From: arthur@solomon.technet.sg (Arthur Sombrito) Newsgroups: comp.std.c++ Subject: ARM Specs Contradiction Message-ID: <1992Oct8.123635.10160@nuscc.nus.sg> Date: 8 Oct 92 12:36:35 GMT Sender: usenet@nuscc.nus.sg Organization: National University of Singapore Lines: 40 X-Newsreader: TIN [version 1.1 PL6]