C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Declare multiple aliases at once with `using`.

From: Thiago Macieira <thiago_at_[hidden]>
Date: Thu, 21 Sep 2023 18:42:29 -0700
On Thursday, 21 September 2023 15:59:44 PDT Ferhat Geçdoğan via Std-Proposals
wrote:
> > Why is removing `using` here worthwhile at all?
>
> It just prevents duplicate use of `using` keyword. That's all.

That doesn't look like strong enough motivation. You're saving exactly 6
characters/bytes every time, that's all.

> I would prefer this:
> `unsigned x, y, z;`
>
> Not this (most cases, sometimes it's okay to emphasize some variables):
> `unsigned x;
> unsigned y;
> unsigned z;`

Declaring multiple variables in a single line maybe has a point because the
type of the variable could be long and thus you could save more. But it's also
a wart in the language, with many projects banning its use.

Exhibit A:

  int* x,y;

If you see the problem, you know why it's being banned. If you don't see the
problem, then you should take comfort that this is usually banned and you
don't have to know why that is poor programming.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-09-22 01:42:32