C++ Logo

std-discussion

Advanced search

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

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Mon, 10 Aug 2020 22:00:10 +0300
On Mon, 10 Aug 2020 at 21:54, Thiago Macieira via Std-Discussion
<std-discussion_at_[hidden]> wrote:
>
> 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.

Implementation-defined needs to be documented by the implementation,
whereas unspecified
does not need to be. Because it's unspecified. :P

Received on 2020-08-10 14:04:17