This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
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.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |