Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • What about nothrow new ? The rule of thumb is that whenever you overload new, you must write 12 functions: [array] [{ placement | nothrow }] { new | delete }. Commented Jul 27, 2011 at 7:30
  • @Alexandre: This whole FAQ entry is distilled from guidelines I use for teaching C++, and since nothrow new is more or less just for legacy stuff, I haven't ever even mentioned it. What would you suggest should be written about it here? Commented Jul 27, 2011 at 7:39
  • 1
    @sbi: See (or better, link to) gotw.ca/publications/mill15.htm . It is only good practice towards people which sometimes use nothrow new. Commented Jul 27, 2011 at 8:36
  • 1
    new(buffer) X(/*...*/) what actually guarantees that buffer is properly aligned for X? Commented Dec 2, 2011 at 12:17
  • 2
    "If you do not provide a matching operator delete, the default one is called" -> Actually, if you add any arguments and do not create a matching delete, no operator delete is called at all, and you have a memory leak. (15.2.2, the storage occupied by the object is deallocated only if an appropriate ... operator delete is found) Commented Jan 23, 2015 at 20:30