Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    new and delete operator

    Can anybody tell which header file contains new and delete operators?

  2. #2
    Linux Guru sarumont's Avatar
    Join Date
    Apr 2003
    I assume you are talking about C++...these are part of base C++. They aren't included in any additional files (require by #include<>), if that's what you want to know. Example:

    sarumont@quark ~ $ cat blah.cpp
    int main&#40;&#41;
            int *i = new int&#40;5&#41;;
            std&#58;&#58;cout << *i << std&#58;&#58;endl;
            delete i;
            return 0;
    sarumont@quark ~ $ g++ -Wall blah.cpp
    sarumont@quark ~ $ ./a.out
    sarumont@quark ~ $
    "Time is an illusion. Lunchtime, doubly so."
    ~Douglas Adams, The Hitchhiker's Guide to the Galaxy

  3. #3
    Linux User
    Join Date
    Oct 2004
    On my system at work running Redhat 7.3, the path to the header for new is

    Mind you, these are only DECLARATIONS..
    For the definitions, check out the source code of libstdc++...

    These files are internally (possibly recursively??) #included by one of the system headers - maybe iostream itself?
    Or, maybe the compiler by default includes them in all the sources?

    The same applies to the headers for the C++ ABI and RTTI functionality - you don't need to include them explicitly, yet their functionality is available in your code...
    The Unforgiven
    Registered Linux User #358564

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts