Boost logo

Boost :

From: rwgk_at_[hidden]
Date: 2001-05-18 12:32:01


Attached is another response from Compaq.
What are the implications for Boost.Python?
Ralf

Date: Fri, 18 May 2001 12:29:16 -0400
From: cxxc_bugs_at_[hidden]
To: rwgk_at_c...
Subject: Re: CPP#5241: Subj: cxx_bugreport: problem with friend
functions

----------------------------------------------------------------------
----------
Bjarne Stroustrup's "C++ Programming Language", third
edition, section 11.5.1, explains the behaviour:

"Like a member declaration, a friend declaration does
not introduce a name into an enclosing scope.
...
For large programs and classes, it is nice that
a class doesn't "quietly" add names to its enclosing
scope.
...
A friend function can be explicitly declared just
like the friend classes, or it can be found
through its argument types as if it was declared
in the non-class scope immediately enclosing its
class.

If follows that a friend function should either
be explicitly declared in an enclosing scope
or take an argument of its class. If not
the friend cannot be called. For example:

// no f() here

void g(); // X's friend

class X {
     friend void f(); // useless
     friend void g();
     friend void f(const X&); // can be found through its argument
}

Please send all Compaq C/C++ Support requests to
cxxc_bugs_at_[hidden]
Reply to this message for further correspondence regarding THIS
support
request. Thank you for choosing Compaq C/C++.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk