gcc4 & override operator new/delete
gcc4 & override operator new/delete
- Subject: gcc4 & override operator new/delete
- From: Paul Carnine <email@hidden>
- Date: Thu, 19 Jan 2006 13:11:06 +0100
Folk:
When we override operator new and delete operators in gcc4, our overrides
are getting called by system routines. gcc 3.3 did not exhibit this
behaviour (we've been doing this in our debug builds for years).
I've taken a look at the gcc visibility capability
(http://developer.apple.com/documentation/DeveloperTools/Conceptual/CppRunti
meEnv/index.html), and attempted to specifically hide our overrides by doing
this type of thing:
__attribute__((visibility("hidden"))) void* operator new(size_t size) {
...
}
But the compiler coughs up a warning, and ignores the desired hidden:
MemCheck.cpp: In function 'void* operator new(size_t)':
MemCheck.cpp:128: warning: 'void* operator new(size_t)': visibility
attribute ignored because it
/usr/include/c++/4.0.0/new:84: warning: conflicts with previous
declaration here
Any thoughts?
-pdc
p.s. This is easy to reproduce with the ColorSwatchView sample code. Just
put your own new/delete overrides, break on calls to new and then press the
"Swap Colors" button. In PPC, you'll get a breakpoint deep inside library
load routines. On Intel, you'll actually break on startup in
CreateNibReference().
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden