Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I really recommend having the program trap on overflow. There are some proposals like as-if-infinitely-ranged, which is like bignums but without having to actually store a bignum.

It's really problematic to use them, though. Every integer would turn into a pointer, and the O(N) thing really is a problem. If you're doing secure coding you need careful control of data dependencies, since they create side-channel leaks, and nobody who makes "safe" languages appreciates this.

Plus most people don't need numbers that big. I think it was even a mistake to make size_t 64-bit.



C actually makes it really hard to trap on overflow. It's one of the biggest reasons C kinda sucks.

The way a lot of HLLs do it is to detect a potential overflow, and convert to bignum if needed.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: