🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2349

Re: [Q] Merging identical functions

#2349
From: Steve Clamage
Date: Sun, 29 Oct 1995 23:28
40 lines
2344 bytes
In article it6@engnews1.eng.sun.com, "bnr (n.) postmaster" <postmast@bnr.ca> writes:
>
>I'm running into problems because a package I use under C++ defines
>the same "inline void* operator new(size_t, void* p) { return p; }" as
>the STL does.
>
>Is there anything in the C++ standard that will allow identical
>definitions such as this to be merged?  It seems that, especially with
>the above case, such conflicts are likely to be common.

That should not be a problem for a standard-conforming program, on several
counts.

That version of operator new, among others, is found in standard header <new>,
and probably should not be defined in third-party headers.

Second, real STL is part of the C++ standard library, and all of its
declarations are in namespace <std> (along with the versions of
operator new).

Third, future third-party libraries should not have any global declarations
at all, but place everything in a namespace. That will eliminate name
conflicts entirely, or rather reduce them to the conflict only of namespace
names.

I realize that we are in a transition period, and namespaces are not yet
widely available. Even if your compiler supports them, it will be a while
before third-party libraries use them routinely.

But for this specific case, I would expect that version of operator new
to be found in your compiler's <new.h> header, and so should be removed from
both the version of STL that you are using, and from the header file for
the other package.

---
Steve Clamage, stephen.clamage@eng.sun.com

[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <4710as$it4@engnews1.eng.sun.com>
Path: arc1-ca.pugleaf.net!taumet.Eng.Sun.COM!clamage
References: <470tgs$it6@engnews1.eng.sun.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!taumet.Eng.Sun.COM!clamage
From: clamage@Eng.sun.com (Steve Clamage)
Newsgroups: comp.std.c++
Subject: Re: [Q] Merging identical functions
Date: 29 Oct 1995 23:28:42 GMT
Organization: Sun Microsystems Inc.
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <4710as$it4@engnews1.eng.sun.com>
References: <470tgs$it6@engnews1.eng.sun.com>
Reply-To: clamage@Eng
NNTP-Posting-Host: taumet.eng.sun.com
Content-Type: text
X-Nntp-Posting-Host: taumet.eng.sun.com
Content-Length: 1530
X-Lines: 38
Originator: clamage@taumet.Eng.Sun.COM