[PATCH] libstdc++: Members missing in std::numeric_limits<integer-class type>

Mateusz Zych mte.zych@gmail.com
Fri Jul 4 12:10:56 GMT 2025


Hello!

I've updated the ChangeLog, since I forgot to do it before.

Thanks, Mateusz Zych

On Thu, Jul 3, 2025 at 9:49 PM Mateusz Zych <mte.zych@gmail.com> wrote:

> Hello!
>
> I've prepared a patch, which adds all members missing from
> std::numeric_limits<> specializations for integer-class types.
>
> Jonathan, please let me know whether you like these changes
> and do not see any bugs or issues with them. From my side, I just want to
> say that:
>
>    - Since all std::numeric_limits<> specializations for integral types,
>    defined in //libstdc++-v3/include/std/limits don't inherit from a base
>    class
>    providing common data members and member functions,
>    I also didn't introduce such a base class in
>    //libstdc++-v3/include/bits/max_size_type.h.
>    Such implementation has quite a bit of code duplication, but it's like
>    that on purpose, right?
>
>    - I didn't test the traps static data member, because I don't know how
>    to
>    accurately predict when this compile-time constant should be true and
>    when it should be false.
>    Moreover, I saw that the unit-test verifying correctness of the traps
>    constant
>    from std::numeric_limits<> specializations for integral types
>    (//libstdc++-v3/testsuite/18_support/numeric_limits/traps.cc) also
>    doesn't verify its value.
>
>    - In the unit-tests for integer-class types I've defined variable
>    template
>    verify_numeric_limits_values_not_meaningful_for<> to avoid code
>    duplication
>    and have clear and readable code. I hope this is OK.
>
> Thanks, Mateusz Zych
>
> On Wed, Jul 2, 2025 at 7:30 PM Jonathan Wakely <jwakely@redhat.com> wrote:
>
>> On Wed, 2 Jul 2025 at 17:15, Mateusz Zych wrote:
>> >
>> > OK, then I’ll prepare appropriate patch with tests and send it when I’m
>> done implementing it.
>>
>> That would be great, thanks. I won't push the initial patch, we can
>> wait for you to prepare the complete fix.
>>
>> Please note that for a more significant change, we have some legal
>> prerequisites for contributions, as documented at:
>> https://gcc.gnu.org/contribute.html#legal
>>
>> If you want to contribute under the DCO terms, please read
>> https://gcc.gnu.org/dco.html so that you understand exactly what the
>> Signed-off-by: trailer means.
>>
>> Thanks!
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20250704/7a375570/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Added missing members to numeric_limits specializations for integer-class types.patch
Type: text/x-patch
Size: 9231 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20250704/7a375570/attachment.bin>


More information about the Libstdc++ mailing list