C++ Logo

std-discussion

Advanced search

Re: Padding bits stability

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sun, 10 Nov 2024 15:17:19 -0800
On Sunday 10 November 2024 14:55:00 Pacific Standard Time Mykola Garkusha via
Std-Discussion wrote:
> Say one could ensure padding bits set to 0 on creation or during
> the lifetime of an object and later compare the object with *memcmp *knowing
> ahead that the object value does not change and even it does one could
> again reset padding bits to 0 to use *memcmp*

Are you trying to type-erase a comparison operation?

Because if not, just do a regular operator== comparison over the range of
items and the compiler will emit the memcmp() calls for you if the type is
trivially comparable.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2024-11-10 23:17:25