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

The problem is that it is "potentially unsafe" depending on what OTHER code does. For example, if some other code happens to manipulate the same bytes as an array of uint16_t (but not char/uint8_t) it's wrong (like in that example). Similarly if some other code manipulates the same bytes as some other struct type, it's also wrong. Yes it is possible to do it this way and not have undefined behavior, but you are leaving trap doors open that you don't even know about.


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

Search: