by caf · 7y ago · 0 comments
Only if their address doesn't escape.
My phrasing was probably a bit ambiguous there.
However, it can still cheat by rearranging the memory write or even letting linker initialize the address.
An explicitly const-qualified object instead can be replaced with its value even if its address has escaped.