On Fri, 5 Jan 2024 at 13:00, Martin Küttler <martin.kuett...@kernkonzept.com> wrote: > > > >>This is a small change to libstdc++ which does not change any behavior. > > > > Please CC the libstd...@gcc.gnu.org list on all libstdc++ patches, as > > documented at https://gcc.gnu.org/lists.html > > Acknowledged. Sorry. > > >>This change has two, ihmo positive, implications: > >> > >> - The implicit conversion from double to int is avoided (Avoiding a > >> warning). > > > > I don't see any warning here. What do you see? > > I see "warning: conversion from ‘double’ to ‘int’ may change value > [-Wfloat-conversion]" This appears to be a specifically enabled warning. > > > Looking at path::_List::reserve now, we probably also want to avoid > > overflow. Although a path with INT_MAX/1.5 components seems > > implausible for 32-bit and 64-bit targets, it could be a problem for > > 16-bit targets. I'll take care of that too. > > Nice catch.
We also have some redundant code in path::operator/= which can just be removed, because _List::reserve does it anyway: if (orig_type == _Type::_Multi) { const int curcap = _M_cmpts._M_impl->capacity(); if (capacity > curcap) capacity = std::max(capacity, (int) (curcap * 1.5)); }