4 6517
* Alex Vinokur:
Foo* p = new (nothrow) Foo;
Should we use
operator delete (p, nothrow) ?
No.
Or can we use
delete p; ?
Yes.
--
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?
Alex Vinokur wrote:
Alf P. Steinbach wrote:
* Alex Vinokur:
Foo* p = new (nothrow) Foo;
>
Should we use
operator delete (p, nothrow) ?
No.
Can we use
operator delete (p, nothrow) ?
not like that, you must call it in a normal function call way
if Foo has a delete operator like this
void operator delete(void *, std::nothrow_t)
Foo * p = new (std::nothrow) Foo;
p->operator delete(p, std::nothrow);
dasjotre wrote:
Alex Vinokur wrote:
Alf P. Steinbach wrote:
* Alex Vinokur:
Foo* p = new (nothrow) Foo;
Should we use
operator delete (p, nothrow) ?
>
No.
Can we use
operator delete (p, nothrow) ?
not like that, you must call it in a normal function call way
if Foo has a delete operator like this
void operator delete(void *, std::nothrow_t)
Foo * p = new (std::nothrow) Foo;
p->operator delete(p, std::nothrow);
ups, sorry, I didn't wake up yet This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dave |
last post by:
Is it possible for the nothrow form of the new operator to ever throw?
|
by: Jay Nabonne |
last post by:
Hi,
This might sound odd, but we want to replace the allocation scheme used by
new and delete without changing operator new and operator delete. (The
global operators are shared and we can't change them.)
We can replace operator new functionality by providing additional
parameters to the new function call (ala Stroustrup):
class foo_t;
|
by: shoosh |
last post by:
hi
for my application under VC6 I need to implement my own memory manager
which overrides the global new and delete operators and which Do Not
use the normal free() and malloc().
it seemed to work fine on its own but when I tried to use say 'cout' or
'cerr' from STL
the tester crashed upon termination.
using some breakpoints I found out that when I make use of 'cerr' in the
program, there
is a call to my override of delete which do not...
|
by: Alex Vinokur |
last post by:
GNU g++ 3.3.3, Cygwin
// Stuff
static char* mbuffer = NULL;
// Stuff
void doit()
|
by: Dave |
last post by:
Hello all,
I'd like to find a source on the web that discusses, in a comprehensive
manner and in one place, everything about new / delete. It should include
overloading operator new, the new operator, placement, nothrow, arrays,
etc...
My books cover the topic, I've found FAQs on the web that cover the topic,
and so on, but all the sources I've found are disjointed. There's a bit on
this page, a bit on that page, and so on. The...
| |
by: Alex Vinokur |
last post by:
Should 'delete below (after casting to void*)' work fine?
------------------------------------------
char* p1 = new (nothrow) char;
if (p1 == 0) return;
void* p2 = reinterpret_cast<void*> (p1);
delete p2;
------------------------------------------
Alex Vinokur
|
by: Lighter |
last post by:
Big Problem! How to overload operator delete?
According to C++ standard, "A deallocation function can have more than
one parameter."(see 3.7.3.2); however, I don't know how to use an
overloaded delete operator. Let me use an example to illustrate this:
/********************************************************/
#include <new>
#include <iostream>
|
by: Alex Vinokur |
last post by:
What is difference between
delete p;
and
delete(nothrow)p;
?
--
Alex Vinokur
email: alex DOT vinokur AT gmail DOT com
http://mathforum.org/library/view/10978.html
|
by: Dustan |
last post by:
This is the biggie that has been keeping me from even trying to use C+
+ for more than about 10 seconds: it doesn't work. I've been able to
get java and (of course) python programs to compile and run, but not C+
+.
I copied a program from http://www.cplusplus.com/doc/tutorial/dynamic.html
(if that's a bad place to go for a tutorial, feel free to direct me
elsewhere), and the following line gets an error:
p= new (nothrow) int;
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |