how to handle the exception handling when NEW operator failed to allocate memory

Discussion in 'C++' started by jayapal, Jul 17, 2007.

  1. jayapal

    jayapal Guest

    Hi ,

    I am using the NEW operator to allocate the memory in many places of
    my code.But I am not doing any error hadling or exception handling.Can
    any one suggests me how to do exception handling, which code part I
    have to add to do the exception handling

    Thanks in advance,

    ..
     
    jayapal, Jul 17, 2007
    #1
    1. Advertising

  2. jayapal

    James Kanze Guest

    On Jul 17, 1:02 pm, jayapal <> wrote:

    > I am using the NEW operator to allocate the memory in many places of
    > my code.But I am not doing any error hadling or exception handling.Can
    > any one suggests me how to do exception handling, which code part I
    > have to add to do the exception handling


    You handle it just like any other exception. Except that
    typically, you can't do much to recover, and in most
    applications, it's preferable to just set the new_handler to
    abort with an error message.

    --
    James Kanze (GABI Software) email:
    Conseils en informatique orientée objet/
    Beratung in objektorientierter Datenverarbeitung
    9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
     
    James Kanze, Jul 18, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alan Gifford
    Replies:
    4
    Views:
    393
    tom_usenet
    Oct 27, 2003
  2. Bryan Parkoff

    new -- allocate memory question

    Bryan Parkoff, Apr 5, 2005, in forum: C++
    Replies:
    1
    Views:
    423
    Alf P. Steinbach
    Apr 5, 2005
  3. Replies:
    2
    Views:
    324
    benben
    Nov 26, 2006
  4. jayapal
    Replies:
    3
    Views:
    388
  5. firejdl
    Replies:
    0
    Views:
    150
    firejdl
    Mar 22, 2006
Loading...

Share This Page