 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Lighter Guest
|
Posted: Wed Aug 09, 2006 9:10 am Post subject: The C++ Standard Doesn't Permit Overloading new and delete? |
|
|
The C++ Standard Doesn't Permit Overloading new and delete?
In the 13.5 of The C++ standard (ISO/IEC 14882, 1998), I cannot find
the specification on overloading the operators new and delete; however,
many C++ books including "C++ Primer" say that the operators new and
delete can be overloaded. I wonder if this has definitive
specification? Who can tell me?
Many thanks to those who answer.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ] |
|
| Back to top |
|
 |
Jean-Louis Leroy Guest
|
Posted: Wed Aug 09, 2006 5:35 pm Post subject: Re: The C++ Standard Doesn't Permit Overloading new and dele |
|
|
| Quote: | In the 13.5 of The C++ standard (ISO/IEC 14882, 1998), I cannot find
the specification on overloading the operators new and delete
|
See 3.7.3.
--
Jean-Louis Leroy
Sound Object Logic
http://www.soundobjectlogic.com
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ] |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Aug 09, 2006 5:35 pm Post subject: Re: The C++ Standard Doesn't Permit Overloading new and dele |
|
|
Lighter wrote:
| Quote: | The C++ Standard Doesn't Permit Overloading new and delete?
In the 13.5 of The C++ standard (ISO/IEC 14882, 1998), I cannot find
the specification on overloading the operators new and delete; however,
many C++ books including "C++ Primer" say that the operators new and
delete can be overloaded. I wonder if this has definitive
specification? Who can tell me?
Many thanks to those who answer.
|
Even I thought that new and delete cannot be overloaded, so if
you got somthing please do tell me........
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ] |
|
| Back to top |
|
 |
Martin Bonner Guest
|
Posted: Wed Aug 09, 2006 5:36 pm Post subject: Re: The C++ Standard Doesn't Permit Overloading new and dele |
|
|
Lighter wrote:
| Quote: | The C++ Standard Doesn't Permit Overloading new and delete?
In the 13.5 of The C++ standard (ISO/IEC 14882, 1998), I cannot find
the specification on overloading the operators new and delete; however,
many C++ books including "C++ Primer" say that the operators new and
delete can be overloaded.
|
See 3.7.3.1, and in particular 5.3.4 p8 (and subsequent paragraphs).
12.5 is also useful.
You need to search for "operator new".
| Quote: | I wonder if this has definitive specification?
Well clearly the standard document is definitive for standard C++. |
However it requires a signficant level of expertise to interpret.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ] |
|
| Back to top |
|
 |
Ron Natalie Guest
|
Posted: Thu Aug 10, 2006 5:34 pm Post subject: Re: The C++ Standard Doesn't Permit Overloading new and dele |
|
|
Lighter wrote:
| Quote: | The C++ Standard Doesn't Permit Overloading new and delete?
In the 13.5 of The C++ standard (ISO/IEC 14882, 1998), I cannot find
the specification on overloading the operators new and delete; however,
many C++ books including "C++ Primer" say that the operators new and
delete can be overloaded. I wonder if this has definitive
specification? Who can tell me?
The new and delete operators CAN NOT be overloaded. |
There are functions called "operator new" and "operator delete"
but they are unfortunate names. Rather than being the implementation
of those operators, they are the memory allocation functions
that new/delete calls.
There's too much happening behind the scenes of object creation
that you can't implement even if you wanted to do so. Your
stuck with playing with the allocation functions and the constructors
themselves.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ] |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|