C++에서 UB는 하드웨어 수준에서는 UB가 아니라고 생각했던 얼마 전에 나어게 경종을 올렸던 글. "Pointers are complicated" 시리즈. 주로 Rust에 관한 글이지만 abstract machine, memory model의 개념은 C++에도 있으며 하드웨어와는 확연히 다르다. 특히 포인터가 얼마나 까다로운 개념인지, 컴파일러가 어떠한 가정하에서 최적화를 수행하는지 다시금 익혔다.

6

If you have a fediverse account, you can quote this note from your own instance. Search https://hackers.pub/ap/notes/01996551-6d28-7562-8cdd-7a96e93651af on your instance and quote it. (Note that quoting is not supported in Mastodon.)

여러분 int *p를 (int *)(uintptr_t)p 캐스팅하지 마세요 출처라는 것이 바뀝니다

1