C++ Logo


Advanced search

Re: reading values as bytes without memcpu, from enum unsigned char?

From: Thiago Macieira <thiago_at_[hidden]>
Date: Mon, 10 Aug 2020 11:53:51 -0700
On Monday, 10 August 2020 11:05:03 PDT language.lawyer_at_[hidden] wrote:
> > defined in the standard as (UCHAR_MAX + 2) modulo (UCHAR_MAX + 1), which
> > equals 1. But it doesn't, on any big-endian machine.
> This is not a proof of that the result currently is implementation-defined.
> It is a proof that the Standard is prolly currently defective and doesn't
> reflect the behavior of most "ordinary" implementations.
> Implementation-defined behavior must be explicitly marked as such and I'd
> expect to see it in https://timsong-cpp.github.io/cppwp/n4861/impldefindex

Ok, then we agree: this behaviour must not be UB. It needs to either be
implementation-defined or unspecified (but valid). I don't claim to know the
distinction between these two.

Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DPG Cloud Engineering

Received on 2020-08-10 13:57:17