Subject: Re: [std-proposals] Reserve good keywords for floating point types
From: Thiago Macieira (thiago_at_[hidden])
Date: 2019-10-16 00:58:40
On Tuesday, 15 October 2019 11:51:02 PDT Andrey Semashev via Std-Proposals
> On 2019-10-15 20:33, Thiago Macieira via Std-Proposals wrote:
> > Also, don't forget uinptr_t, size_t and ptrdiff_t. You *really* shouldn't
> > use a specific bit count when dealing with object sizes and pointers.
> > That means you don't need uint32_t for counting the elements in an array
> > that you declared in your function. int, size_t or ptrdiff_t would be
> > just fine.
> Actually, you do, if you want to be efficient. Most of the time you
> don't need 64-bit size_t to represent element count or object sizes.
> Storing size_t would just waste space.
My point was the other way around: you shouldn't use uint64_t for the size of
an in-memory structure. On 32-bit systems, it can't be that big, so you're
just wasting CPU cycles with a variable bigger than necessary.
Using a smaller type when you know that your object cannot grow beyond the
bounds of that variable is fine.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Software Architect - Intel System Software Products
STD-PROPOSALS list run by email@example.com
Standard Proposals Archives on Google Groups