Hacker News new | ask | show | jobs
by AstralStorm 2498 days ago
The compiler will detect any attempt at taking the address of the variable (including fancy things like most inline assembly) and skip the optimization, marking it as requiring a memory location.

However, it can still cheat by rearranging the memory write or even letting linker initialize the address.

1 comments

We are in violent agreement.

An explicitly const-qualified object instead can be replaced with its value even if its address has escaped.