Article View: comp.std.c++
Article #1696Re: STL operators != > <= >=
From: Etay Bogner
Date: Wed, 09 Aug 1995 21:45
Date: Wed, 09 Aug 1995 21:45
51 lines
2134 bytes
2134 bytes
The problem might be the overloading rules BETWEEN namespaces.
If I remember correctly, the following example produces an error :
namespace N1 {
void f();
void g();
};
namespace N2 {
void f();
};
using namespace N1;
using namespace N2;
void N1::g() {
f(); // here is the catch ( error )
}
I think that the draft says that the call of "f" in N1::g() is ambiguous.
If not, and the language says that N1::f() should be called, all is well.
Anyways, The compiler should prefer N1::f() over the error ( again, if it's an error ).
The reason :
void f();
class X {
void f();
void g();
};
void X::g() {
f(); // here it's OK. calls X::f() and NOT ::f()
}
Since the language is smart enough to say that X::f() is "more-related" to X::g() than ::f()...
This is quite reasonable : namespaces are actually WIDER class definitions, such that can be split among
several files. The functions have the namespace relationship in their names, exactly as member functions
( => the mangled name of X::g() will contain somewhere that it belongs to namespace X ).
If I'm NOT wrong, meaning that overloading between namespaces IS ambigiuous, I guess that treating
namespaces as WIDER classes will provide the answer to the discussed problem.
-- Etay Bogner,
-- ebogner@ird.scitex.com ( OLD ),
-- Etay_Bogner@mail.stil.scitex.com,
-- Scitex Corp.
-- Israel.
Technical Details
Message-ID:
<40ba9d$5ij@lyman.pppl.gov>Path:
arc1-ca.pugleaf.net!nntpserver.pppl.gov!usenetReferences:
<3vpmv5$4t7@mujibur.inmind.com> <3vpnrq$50c@mujibur.inmind.com> <MATT.95Aug7100148@godzilla.EECS.Berkeley.EDU> <4065oq$3f4@mujibur.inmind.com> <407n9d$nb7@lyman.pppl.gov> <409bjt$59c@mujibur.inmind.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!nntpserver.pppl.gov!usenet From: Etay Bogner <Etay_Bogner@mail.stil.scitex.com> Newsgroups: comp.std.c++ Subject: Re: STL operators != > <= >= Date: 9 Aug 1995 21:45:17 GMT Organization: Scitex Corp. Message-ID: <40ba9d$5ij@lyman.pppl.gov> References: <3vpmv5$4t7@mujibur.inmind.com> <3vpnrq$50c@mujibur.inmind.com> <MATT.95Aug7100148@godzilla.EECS.Berkeley.EDU> <4065oq$3f4@mujibur.inmind.com> <407n9d$nb7@lyman.pppl.gov> <409bjt$59c@mujibur.inmind.com> NNTP-Posting-Host: applepo12.scitex.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 1.1N (Macintosh; I; PPC) To: mfinney@inmind.com X-URL: news:409bjt$59c@mujibur.inmind.com