In article <[EMAIL PROTECTED]> you write:
>The assert should not overflow.  I suggest
>
>#include <stdlib.h>
>#include <stdint.h>
>assert( n < SIZE_MAX / sizeof(int) );
>
>which requires two pieces of information that the programmer
>otherwise wouldn't need, SIZE_MAX and sizeof(type).
>
>Asking programmers to write extra code for rare events, has
>not been very successful.  It would be better if the compiler
>incorporated this check into operator new, though throwing
>an exception rather than asserting.  The compiler should be
>able to eliminate many of the conditionals.

The compiler and its runtime should be correct, and programmers should be 
able to depend on it.

When you read the documentation for new or calloc, there is no
mention of integer overflow, it is not expected that the programmer
has to know about that.

Adding an extra test in user code even  less sense than checking
that pointers are not null before calling free...

Reply via email to