On Wed, 24 May 2023 at 10:06, Florian Weimer wrote: > > * Jonathan Wakely via Gcc: > > >> It seems it might even be trivial enough for me to investigate and > >> tackle myself, in some spare time. > >> > >> I see very little code using either of these features, so it's > >> definitely not a high priority task regardless. > >> > > > > Glibc uses the nonnull attribute in many places. Libstdc++ uses it in a few > > places. > > Note that the glibc uses are frequently incompatible with libstdc++
Do you mean incompatible with libstdc++ specifically, or incompatible with "common C++ idioms"? > (std::vector in particular). Unfortunately, there is no consensus to > fix this. For example, one issue is that > > memset(vec.data(), 0, sizeof(decltype(vec)::value_type) * vec.size()) > > isn't necessarily defined even for vectors of POD type. It's not really idiomatic C++ code anyway. Why would you write that, instead of: vec.assign(vec.size(), {}); or: std::fill_n(vec.begin(), vec.size(), range_value_t<decltype(vec)>:{}); ? (The latter optimizes to the ideal code, but I think I know how to make the former optimize to the same thing.)