Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > memory allocation checking

Reply
Thread Tools

memory allocation checking

 
 
Kev
Guest
Posts: n/a
 
      09-15-2005
Hi

Is the preferred method when checking whether or not 'new' succeeded to use
'null' or 'throw/catch'(I think I have that right)? Ive seen both used.

Thx
 
Reply With Quote
 
 
 
 
Jon Slaughter
Guest
Posts: n/a
 
      09-15-2005

"Kev" <(E-Mail Removed)> wrote in message
news:Xns96D26DC01E02Dkevsmail@216.168.3.44...
> Hi
>
> Is the preferred method when checking whether or not 'new' succeeded to
> use
> 'null' or 'throw/catch'(I think I have that right)? Ive seen both used.
>
> Thx





http://www.parashift.com/c++-faq-lit....html#faq-16.6

Jon


 
Reply With Quote
 
 
 
 
Howard
Guest
Posts: n/a
 
      09-15-2005

"Kev" <(E-Mail Removed)> wrote in message
news:Xns96D26DC01E02Dkevsmail@216.168.3.44...
> Hi
>
> Is the preferred method when checking whether or not 'new' succeeded to
> use
> 'null' or 'throw/catch'(I think I have that right)? Ive seen both used.
>
> Thx


The preferred method is to use a standard-compliant compiler, which throws
an exception when new fails.

(And it's NULL, not null, by the way.)

-Howard


 
Reply With Quote
 
Kev
Guest
Posts: n/a
 
      09-15-2005
"Jon Slaughter" <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> http://www.parashift.com/c++-faq-lit....html#faq-16.6


Ah I see. Clears up several things.

Thx.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
An idea for heap allocation at near stack allocation speed Bjarke Hammersholt Roune C++ 14 03-06-2011 08:07 AM
static memory allocation versus dynamic memory allocation Ken C Programming 24 11-30-2006 12:37 AM
What is the difference between dynamic memory allocation,and stack allocation ? chris C++ 6 10-28-2005 05:27 AM
Exception checking memory allocation. How? benben C++ 16 07-31-2005 01:31 AM
checking stl vector successful memory allocation kwijibo28 C++ 6 08-11-2003 03:34 PM



Advertisments