Re: ``definition once" applies on ::operator new ?
On 7 8 , 5 49 , "comp.lang.c++.moderated" <dhb2...@gmail.com> wrote:
//mynew.cpp
void* operator new (size_t sz)
{
return 0;
}
// main.cpp
void* operator new (size_t);
int main()
{
new char;
}
The code above compiles with my icl 9.0
I remember once I got "operator new(unsigned int) has already defined"
compile-time error
So is there something special with the operator new definition?
--
[ Seehttp://www.gotw.ca/resources/clcm.htmfor info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
I wanna make my question more concrete.
When I use MSVC to debug my app, when come to the new expression, I
press F11, then I can enter the new operator function from CRT source
code, so i think there's already a new operator function built into
the msvc.crt library, So why no "defintition once" problem if I define
another ::operator new function?
Or the new expression is special, there's no corresponding function in
the run-time library (implemented like throw or something, but F11
does NOT apply on ``throw" expression), only when I use debug mode
(and press F11) then the code is shown, and this code has nothing to
do with the run-time library?
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]