On Wed, Apr 05, 2017 at 05:03:33PM +0100, Jonathan Wakely wrote: > > I wanted to say it behaves mostly like __attribute__((may_alias)) > > except that may_alias only has an effect on pointers and references > > but not when accessing an object directly, (I hope you know what > > I mean). > > And may_alias is not a very helpful name either. > > I much prefer Richi's suggestion of typeless_storage. > > But I'm not convinced we need the attribute at all. If a struct > containing an array of std::byte or unsigned char has the property > already then that's good. I don't think we need a non-portable way to > make other types behave the same. If you can change the code to use a > new GCC attribute then you can change the code to use an array of > unsigned char, and be portable.
It will only work that way in C++ though, so if you want to achieve the same in C, which doesn't have any special case for unsigned char arrays nor std::byte, you need an attribute. Jakub