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

2^(bitsize) == 0.

Edit: Yes, 1 << bitsize is undefined. But unsigned integers actually do have well-defined semantics on overflow, and multiplying by 2 enough times really does produce zero.



Actually, it's undefined behaviour. http://blog.regehr.org/archives/213


2^(bitsize) == 2^(bitsize)

If you meant 1 << (bitsize), that's undefined behaviour in C




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: