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

> Also, note that if you move the "int a, b" to outside main, so a and b are on the heap instead of on the stack, then gcc does find that the pointers are equal.

This is also an utter accident, since it depends a great deal on the toolchain. I've worked on compilers and linkers that will put the variables in totally separate parts of the binary (e.g., based on name hash).



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

Search: