Allocation with new operator and Destroying with free operator

Discussion in 'C++' started by saikishore.vanga@wipro.com, Dec 20, 2005.

  1. Guest

    Hi,
    I want to know whether if we are allocating with new operator
    ..Whats happening if we are deleting with FREE operator.If it is not
    possible. What is the problem.
    and also if new and Delete be overloaded. How can overload new and
    delete operator?
    Plz If You have answer Give to me reply.
    Thanks
    Saikishore
    , Dec 20, 2005
    #1
    1. Advertising

  2. mlimber Guest

    Re: Allocation with new operator and Destroying with free operator

    wrote:
    > Hi,
    > I want to know whether if we are allocating with new operator
    > .Whats happening if we are deleting with FREE operator.If it is not
    > possible. What is the problem.
    > and also if new and Delete be overloaded. How can overload new and
    > delete operator?
    > Plz If You have answer Give to me reply.
    > Thanks
    > Saikishore


    First, there is no such thing as a "free operator". There is a free
    function and a delete operator.

    Second, see this FAQ:

    http://www.parashift.com/c -faq-lite/freestore-mgmt.html#faq-16.3

    In essence, new and delete do not need to rely on malloc/free to get
    memory, and just because one implementation does it that way doesn't
    mean all do. The standard leaves compiler implementers free to do it
    differently if they so choose.

    Cheers! --M
    mlimber, Dec 20, 2005
    #2
    1. Advertising

  3. wrote:
    > I want to know whether if we are allocating with new operator
    > .Whats happening if we are deleting with FREE operator.


    There is no such thing as "FREE operator". Please rephrase.

    >If it is not
    > possible. What is the problem.
    > and also if new and Delete be overloaded. How can overload new and
    > delete operator?


    Please refer to FAQ or your favorite C++ book.

    > Plz If You have answer Give to me reply.


    If it means what I think it means, then no. Post here, read here.

    V
    Victor Bazarov, Dec 20, 2005
    #3
  4. mlimber Guest

    Re: Allocation with new operator and Destroying with free operator

    mlimber wrote:
    > wrote:
    > > and also if new and Delete be overloaded. How can overload new and
    > > delete operator?


    Forgot this part. See this FAQ for a discussion and example of
    overloading new/delete:

    http://www.parashift.com/c -faq-lite/dtors.html#faq-11.14

    Cheers! --M
    mlimber, Dec 20, 2005
    #4
  5. Earl Purple Guest

    Re: Allocation with new operator and Destroying with free operator

    mlimber wrote:
    >
    > First, there is no such thing as a "free operator". There is a free
    > function and a delete operator.


    If there's a free function can I have an invite?
    Earl Purple, Dec 20, 2005
    #5
  6. BobR Guest

    Re: Allocation with new operator and Destroying with free operator

    Earl Purple wrote in message
    <>...
    >
    >mlimber wrote:
    >>
    >> First, there is no such thing as a "free operator". There is a free
    >> function and a delete operator.

    >
    >If there's a free function can I have an invite?


    Sure! We've even invited a one-eyed one-horned flying Purple people eater!!

    Now go to your room, and don't come out until you can explain recursion
    recursively!!

    --
    Bob <G> R
    POVrookie
    BobR, Dec 20, 2005
    #6
  7. Marcus Kwok Guest

    Re: Allocation with new operator and Destroying with free operator

    BobR <> wrote:
    > Now go to your room, and don't come out until you can explain recursion
    > recursively!!


    Recursion: see definition for "Recursion"

    --
    Marcus Kwok
    Marcus Kwok, Dec 21, 2005
    #7
  8. BobR Guest

    Re: Allocation with new operator and Destroying with free operator

    Marcus Kwok wrote in message ...
    >BobR wrote:
    >> Now go to your room, and don't come out until you can explain recursion
    >> recursively!!

    >
    >Recursion: see definition for "Recursion"
    >--
    >Marcus Kwok


    HEY!!! I thought it was stated in the FAQ that we not do peoples homework for
    them!! :-}

    --
    Bob <G> R
    POVrookie
    BobR, Dec 21, 2005
    #8
  9. Neil Cerutti Guest

    Re: Allocation with new operator and Destroying with free operator

    On 2005-12-21, BobR <> wrote:
    >
    > Marcus Kwok wrote in message ...
    >>BobR wrote:
    >>> Now go to your room, and don't come out until you can explain recursion
    >>> recursively!!

    >>
    >>Recursion: see definition for "Recursion"
    >>--
    >>Marcus Kwok

    >
    > HEY!!! I thought it was stated in the FAQ that we not do
    > peoples homework for them!! :-}


    It's OK. He left out the base case.

    --
    Neil Cerutti
    Neil Cerutti, Dec 22, 2005
    #9
    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. Lionel
    Replies:
    5
    Views:
    542
    Stephen M. Webb
    Apr 6, 2005
  2. Ken
    Replies:
    24
    Views:
    3,859
    Ben Bacarisse
    Nov 30, 2006
  3. chris
    Replies:
    6
    Views:
    987
    chris
    Oct 28, 2005
  4. Bartholomew Simpson

    creating with new and destroying with free

    Bartholomew Simpson, Jun 4, 2007, in forum: C++
    Replies:
    3
    Views:
    292
    Bo Persson
    Jun 4, 2007
  5. Bjarke Hammersholt Roune
    Replies:
    14
    Views:
    1,182
    Bjarke Hammersholt Roune
    Mar 6, 2011
Loading...

Share This Page