3 ms·
On some architectures, an uninitialized value may contain either a trap representation or a valid value, so enforcing any consistent implementation defined beha
by bluetomcat 11y ago
On some architectures, an uninitialized value may contain either a trap representation or a valid value, so enforcing any consistent implementation defined behavior seems impossible.
- tomp 11y agoReally? I didn't know that. Which architectures are that (that contain a trap)? Still, crashing would be a valid "implementation-defined" behaviour in my book.
- bluetomcat 11y agox86 has signalling floating-point NaNs, for example. This means that any attempt to access an uninitialized floating-point value could potentially crash the program (or at least affect the control flow).
- tomp 11y agoHm... according to the example at http://en.cppreference.com/w/cpp/types/numeric_limits/signaling_NaN http://en.cppreference.com/w/cpp/types/numeric_limits/signal... sNaN doesn't actually trap - it just records a special bit in a FPU exception register. So yes, it can affect the control flow - which is something you should expect reading aribtrary values!
- pdw 11y agoOn Itanium, each register contains a trap bit. Any uninitialized value might be a trap representation on that architecture. https://blogs.msdn.microsoft.com/oldnewthing/20040119-00/?p=41003/ https://blogs.msdn.microsoft.com/oldnewthing/20040119-00/?p=...