Boost logo

Boost :

Subject: Re: [boost] [beast] Formal review
From: Peter Dimov (lists_at_[hidden])
Date: 2017-07-12 14:54:57

Andrey Semashev wrote:

> I think the best solution would be to mark size_t with
> __attribute__((__may_alias__)) and use it instead of plain size_t.

No, the problem with this code is (realistically speaking) not aliasing,
it's object lifetime. I don't think that any compiler is so strict as to
break it though; not yet, and maybe not ever.

(There's another source of _technically UB_, padding bits and trap
representations, but we can also reasonably assume that they don't mater
nowadays. Incidentally, unsigned char is the best type with which to access
object representations, although all three narrow character types (and now
std::byte) work.)

Boost list run by bdawes at, gregod at, cpdaniel at, john at