C++ Logo

STD-DISCUSSION

Advanced search

Subject: Re: reading values as bytes without memcpu, from enum unsigned char?
From: Thiago Macieira (thiago_at_[hidden])
Date: 2020-08-10 13:53:51


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

STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org

Older Archives on Google Groups