Thread: Delete[] Error...

  1. #16
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by Zach L.
    Hmm... How does std::exception work (in general), then? I had the same idea in my head that Daved did.
    The way std::exception works is that all members (including constructors) are required not to throw exceptions. So, for exception types with constructors that accept a string argument (eg logic_error) will attempt to copy the string into the place returned by the what() member function. If that operation fails (i.e. an exception is thrown) the result is that exceptions specification of the affected constructor has been violated, which results in program termination (via a call to terminate()).

  2. #17
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    >> Strictly speaking (the letter of the standard) it is out of scope for the caller and therefore an access to it (particularly dereferencing it) yields undefined behaviour.

    These sections of the standard seem to indicate otherwise.

    Section 2.13.4, paragraph 1:
    A string literal is a sequence of characters (as defined in 2.13.2) surrounded by double quotes, optionally beginning with the letter L, as in "..." or L"...". A string literal that does not begin with L is an ordinary string literal, also referred to as a narrow string literal. An ordinary string literal has type “array of n const char” and static storage duration (3.7), where n is the size of the string as defined below, and is initialized with the given characters.
    Section 3.7.1, paragraph 1:
    All objects which neither have dynamic storage duration nor are local have static storage duration. The storage for these objects shall last for the duration of the program (3.6.2, 3.6.3).
    What are we missing?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 09:15 PM
  3. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 01:10 AM