C++ allocator<X>::deallocate(NULL,1) allowed?

Both free(NULL) and ::operator delete(NULL) are allowed. Does the allocator concept (e.g. std::allocator also allow deallocate(NULL,1), or is it required to put your own guard around it?


You'll need to add your own check.

According to §20.4.​1.1/8, deallocate requires:

p shall be a pointer value obtained from allocate(). n shall equal the value passed as the first argument to the invocation of allocate which returned p.

allocate throws an exception when storage can't be given (§20.4.​1.1/7). In other words, allocate never returns 0, and therefore deallocate should never get a 0. Passing a 0 would lead to undefined behavior.

Need Your Help

Jquery append() profile(data from server using $.getJSON) in the same page

javascript jquery jquery-mobile

Stuck to display profile(data from server using $.getJSON) in the same page using jQuery append(), as I'm new to this platform. Commented out the area where I stuck,

Gnuplot / Ghostscript create a table of content

gnuplot ghostscript

I'm currently developping a java application that processes information and that info has to be saved as graphs in a pdf file. I got like 60 graphs as output, all with a different title.