C/C++では高速化のためCPUのマシン・アーキテクチャをそのまま使う。
マシン・アーキテクチャによって little endian と big endian の違いが有るのでC++言語仕様としては定義されてないが、「but most compilers define」なっている。
これはつまり、littele endian の CPUなら、そのまま little endian での表現がそのまま読みとられ、big endian の CPUなら、そのまま big endian での表現がそのまま読み取られることを意味している。
たとえば、cppreference では、
「reading from n or c is UB but most compilers define it」
となっており、
32BIT値の 0x12345678の場合に、unionで 16BIT 配列の0要素目に0x0011を代入すると、
0x12340011 or 0x00115678
が読み取られるように書いてある。
undefined behaviour であっても、このどちらかに限定されると言うことであろう。

https://en.cppreference.com/w/cpp/language/union

union S
{
  std::int32_t n;   // occupies 4 bytes
  std::uint16_t s[2]; // occupies 4 bytes
  std::uint8_t c;   // occupies 1 byte
};           // the whole union occupies 4 bytes

int main()
{
  S s = {0x12345678}; // initializes the first member, s.n is now the active member
  // at this point, reading from s.s or s.c is undefined behavior
  std::cout << std::hex << "s.n = " << s.n << '\n';
  s.s[0] = 0x0011; // s.s is now the active member
  // at this point, reading from n or c is UB but most compilers define it
  std::cout << "s.c is now " << +s.c << '\n' // 11 or 00, depending on platform
       << "s.n is now " << s.n << '\n'; // 12340011 or 00115678
}