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

That's undefined behavior meaning that anything might happen, including appearing to work [most of the time]. C allows casts between two data pointers and between two function pointers, but not cast that cross the data/function boundary.

Any cast that crosses function/data boundary must go through suitably large integer type; UB results if you cast a pointer to a too-small integer type. See my other comment in this thread for a reference to the standard.



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

Search: