"J.C. Pizarro" <[EMAIL PROTECTED]> writes: | > Good points. | > | > 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. | > | > If possible, I would prefer a solution that's built-in to operator | > new. I was thinking it should be implemented when code is | > generated, for example using jc/jo/seto on i386. | > | > -- | > Karl 2007-04-06 15:41 | | I've a good proposition for catching intruders in the code using | an option -DCATCH_NEW_INTRUDER by example: | | int * allocate_int(size_t n) | { | int *p; | #ifdef CATCH_NEW_INTRUDER | log_and_raise_if_new_intruder_anomaly(n,4); | #endif //CATCH_NEW_INTRUDER | p = (int*) operator new[](4 * n); | #ifdef CATCH_NEW_INTRUDER | log_and_raise_if_new_intruder_anomaly_return_not_null(n,4,p); | #endif //CATCH_NEW_INTRUDER | return p; | }
Yuck! -- Gaby