The fact that the Standard does not require implementations to define the behavior of some construct does not imply that implementations intended to be suitable for various purposes shouldn't define it anyway. Many implementations have various options that will cause the compiler to consistently treat some such constructs as defined in ways that are sometimes useful or even necessary to programmers writing certain kinds of code (even though the Standard does not require it).
With regard to your example, there are some implementations where invocation with a suitable combination of options would yield behavior defined precisely as what you see. On many implementations, the required options would include -fno-strict-aliasing
, though some may require other options as well. Some implementations, however, especially those where a vector<uin16_t>
might not be 32-bit aligned, and where loading a float
will fail if it isn't 32-bit aligned, may not support any combination of options that would define the behavior.
Slightly confusing the matter, however, is the fact that even when such options are not used (or not supported), many implementations will treat those constructs in the a fashion that will often--though not reliably--coincide with the way they would if such options were specified and supported. This can make it difficult to determine whether a piece of code can be expected to work consistently, or may sometimes work and sometimes fail, in unpredictable fashion.