C++ Logo

SG14

Advanced search

Subject: Re: [cppcon]
From: Edward Catmur (ecatmur_at_[hidden])
Date: 2019-09-12 13:39:56


Have you considered the low-level approach of allowing the user to specify
the exact location of fields within a class, perhaps by an extension to the
bitfield syntax?

In your example,

struct A {
    // Feature A documentation
    bool feature_a_enabled : 30, 1;
    unsigned int feature_a_value : 16, 14;

    // Feature B documentation
    bool feature_b_enabled : 31, 1;
    unsigned int feature_b_value : 0, 16;
};

So the bitfield syntax would become : [offset, ] width where the offset is
in bits from the beginning of the class.

Of course, overlap would need to make the program ill-formed.

On Mon, Sep 9, 2019 at 8:00 PM Rene Rivera via SG14 <sg14_at_[hidden]>
wrote:

> My entry for the agenda at the CppCon meeting is...
>
> "Member Layout Control"
> <
> https://raw.githack.com/grafikrobot/papers/master/wg21/member_layout/member_layout_D1605R0.html
> >
>
> It's "rough" first attempt at this. But it's good enough for discussion.
>
> --
> -- Rene Rivera
> -- Grafik - Don't Assume Anything
> -- Robot Dreams - http://robot-dreams.net
>
> _______________________________________________
> SG14 mailing list
> SG14_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/sg14
>



SG14 list run by herb.sutter at gmail.com

Older Archives on Google Groups