By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,504 Members | 1,143 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,504 IT Pros & Developers. It's quick & easy.

Global Operators New/Delete and Visibility Across Translation Units

P: n/a

I have overloaded the global new, delete, new[] and delete[] operators
inside a "static library". The library uses private memory allocation
routines that must not be accessible from other translation units.
Other translation units are therefore expected to define and use their
own new/delete operators.

When I link to this library the global new/delete operators conflict,
and although no linker warnings are generated, the result is that
translation units access each others memory allocation routines.

How can I limit the scope of these operator definitions? Apparently it
is not enought to declare them as 'inline' functions, which should only
make them available to translation units which explicitly include the
headers where they are defined.

To avoid this ambiguity I have considered overloading one set of
operators with redundent parameters, such as: void* operator new(
size_t, int )

Any thoughts apreciated.

Thanks in advance,
- dila

Nov 27 '06 #1
Share this Question
Share on Google+
1 Reply

P: n/a
* di*****
I have overloaded the global new, delete, new[] and delete[] operators

And please don't cross-post to clc++ and Microsoft groups.

A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Nov 27 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.