Date: Mon, 11 Nov 2024 22:08:04 +0000
Thanks all. It became more clear especially regarding the C standard.
Having said that, would it not help having ability to at least clear
padding bits intead and reads to get the same value in the absense of
writes? Particularly GCC and Clang already offer intrinsics for that and
then one could have optimizations.
* object could be treated as null by having all of its bits (including
paddings) set to 0
* type-erased comparison
* quicker comparison using memcmp rather then operator== especially if
there are many padding holes in the object.
Indeed clearing padding bits may interfere with other optimizations, though
the programmer would have an option to use this feature or not .
-Mykola
On Mon, Nov 11, 2024 at 7:44 AM Jens Maurer <jens.maurer_at_[hidden]> wrote:
>
>
> On 11/11/2024 05.44, Thiago Macieira via Std-Discussion wrote:
> > On Sunday 10 November 2024 15:27:43 Pacific Standard Time Mykola Garkusha
> > wrote:
> >> Just want to make padding bits stable and don't change between
> subsequent
> >> value modifications so that memcmp actually works.
> >
> > But you need to have a motivation for that. You need to explain why you
> want
> > to memcmp in the first place instead of using operator== or operator<=>.
>
> In particular since we nowadays have defaulted operator== for memberwise
> comparison, so the syntax burden on the user is near zero.
>
> Jens
>
Having said that, would it not help having ability to at least clear
padding bits intead and reads to get the same value in the absense of
writes? Particularly GCC and Clang already offer intrinsics for that and
then one could have optimizations.
* object could be treated as null by having all of its bits (including
paddings) set to 0
* type-erased comparison
* quicker comparison using memcmp rather then operator== especially if
there are many padding holes in the object.
Indeed clearing padding bits may interfere with other optimizations, though
the programmer would have an option to use this feature or not .
-Mykola
On Mon, Nov 11, 2024 at 7:44 AM Jens Maurer <jens.maurer_at_[hidden]> wrote:
>
>
> On 11/11/2024 05.44, Thiago Macieira via Std-Discussion wrote:
> > On Sunday 10 November 2024 15:27:43 Pacific Standard Time Mykola Garkusha
> > wrote:
> >> Just want to make padding bits stable and don't change between
> subsequent
> >> value modifications so that memcmp actually works.
> >
> > But you need to have a motivation for that. You need to explain why you
> want
> > to memcmp in the first place instead of using operator== or operator<=>.
>
> In particular since we nowadays have defaulted operator== for memberwise
> comparison, so the syntax burden on the user is near zero.
>
> Jens
>
Received on 2024-11-11 22:08:16