[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] [lmi-commits] master 98a3720 2/6: Explicitly qualify std::size
From: |
Vadim Zeitlin |
Subject: |
Re: [lmi] [lmi-commits] master 98a3720 2/6: Explicitly qualify std::size_t |
Date: |
Wed, 17 Feb 2021 23:31:06 +0100 |
On Wed, 17 Feb 2021 21:22:02 +0000 Greg Chicares <gchicares@sbcglobal.net>
wrote:
GC> On 2/17/21 1:06 PM, Vadim Zeitlin wrote:
[...]
GC> > finds no matches right now, so it looks like a check for this one would be
GC> > pretty simple. This wouldn't detect (even not commented out) occurrences
of
GC> > size_t at the end of lines, but I don't think there is a real risk of this
GC> > happening in practice.
GC>
GC> Okay, committed and pushed: 24c32d6ed..8d4034b90 master -> master
Thanks!
GC> For the record, I tested this alternative:
GC>
GC> #if 0
GC> boost::sregex_iterator i(f.data().begin(), f.data().end(), r);
GC> boost::sregex_iterator const omega;
GC> for(; i != omega; ++i)
GC> {
GC> boost::smatch const& z(*i);
GC> if
GC> (f.leaf_name() != "test_coding_rules.cpp"
GC> )
GC> {
GC> std::ostringstream oss;
GC> oss
GC> << "contains unqualified 'size_t': '"
GC> << z[0]
GC> << "'."
GC> ;
GC> complain(f, oss.str());
GC> }
GC> }
GC> #endif // 0
GC>
GC> but rejected it:
GC> - it's slower prima facie
GC> - it gives very little more information
GC> - we'll seldom be writing 'size_t' anyway
Agreed on all points.
GC> > Err, gcc definitely requires __cxa_demangle to have this prototype and on
GC> > the platforms where size_t and int have different size (such as Win64), it
GC> > would be a fatal mistake to use int here. Similarly, we still need to use
GC> > size_t when overriding base class virtual functions using it.
GC>
GC> The change I propose is not
GC>
GC> - ,std::size_t* length // just use 0
GC> + ,int* length // just use 0
And I've indeed completely misunderstood you and indeed thought you were
proposing this, thanks for understanding my misunderstanding correctly and
sorry for it in the first place.
GC> but rather
GC>
GC> -// ABI:
GC> +// For reference, the ABI specifies this prototype:
GC> +// extern "C" char* __cxa_demangle
GC> +// (char const * mangled_name // mangled name, NUL-terminated
GC> +// ,char * output_buffer // just use 0
GC> +// ,std::size_t* length // just use 0
GC> +// ,int * status // zero --> success
GC> +// );
GC>
GC> But the change is a little larger than that, and rather than
GC> type it all here, I'll just commit it (master 064c03382).
This is indeed a good change, thanks,
VZ
pgpWk4kDhNFe_.pgp
Description: PGP signature