Date: Thu, 12 Sep 2019 18:51:03 +0000
Whilst this would obviate the need for the layout marker, it would be a maintenance nightmare. Consider what would happen when you add 2 screenfuls of methods in between the members, along with say 10-20 members. Trying to thread the needle to correctly insert a new member would basically be impossible.
From: SG14 [mailto:sg14-bounces_at_lists.isocpp.org] On Behalf Of Edward Catmur via SG14
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_lists.isocpp.org> 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]pp.org
https://lists.isocpp.org/mailman/listinfo.cgi/sg14
________________________________
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
From: SG14 [mailto:sg14-bounces_at_lists.isocpp.org] On Behalf Of Edward Catmur via SG14
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_lists.isocpp.org> 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]pp.org
https://lists.isocpp.org/mailman/listinfo.cgi/sg14
________________________________
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
Received on 2019-09-12 13:53:11