Andrew Pinski wrote:
On 4/6/07, Karl Chen <[EMAIL PROTECTED]> wrote:
Regarding negatives, I believe 'operator new' takes a size_t,
which is unsigned, but if it were signed it, the multiplication
would indeed be in danger of creating a negative.

Actually if it was signed, the whole result would be undefined if
there was an overflow.  Oh by the way unsigned integers don't
overflow, they wrap.  I think the best solution is allow the programer
do the correct thing and have operator new assume what it gets as
being right.


Is that an argument for doing nothing?  I couldn't tell.

One could argue that issuing some type of diagnostic (either at compile time or run time) would be helpful for people that don't remember to write correct code 100% of the time.

David Daney

Reply via email to