Path: csiph.com!aioe.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c++
Subject: Re: Overuse of 'auto'
Date: Fri, 09 Dec 2022 13:07:32 -0800
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <86leng476z.fsf@linuxsc.com>
References: <69e27519-337d-4891-9af3-0cccced7b6abn@googlegroups.com> <87tu2479qc.fsf@bsb.me.uk> <20221209210141.31afa7ff@blackbird.dehmel-lan.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader01.eternal-september.org; posting-host="53a6f3a968d6b54e1413f52d3c3af34e"; logging-data="1389015"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Gbv1RVsGo9dGAHKJd8aDTGxniSqRWY08="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:qnS93BtwRpPwvGGVsaV5Nt/ksXU= sha1:sTHkhYJTxL4c1DSvkTT8+3Y0XmQ=
Xref: csiph.com comp.lang.c++:87788
Andreas Dehmel writes:
> On Fri, 09 Dec 2022 17:44:27 +0000
> Ben Bacarisse wrote:
>
>> Juha Nieminen writes:
>>
>>> [...] I very much oppose the brevity-over-clarity style of
>>> programming.
>>
>> As usual, such rules oversimplify the issues. Sometime clarity can
>> actually come from brevity.
>>
>> It's usually more enlightening to give what you consider good and
>> bad examples as well some examples on the boundary. For example, I
>> rarely want to know more about the type when I see
>>
>> for (const auto &elem : ) ...
>>
>> Where in your spectrum of clarity vs. brevity does this sort of use
>> come?
>
> I'd say it's on the lowest end of the spectrum. As soon as people start
> decorating their "auto" with things like "const", "*" or "&" it
> _always_ is. Either the type is self-explanatory or irrelevant, in
> which case plain "auto" will do, or it isn't, in which case "auto" is
> conceptually wrong. Decorating "auto" like that is just a pathetic
> attempt at hiding this simple fact.
The assertion that "auto" is conceptually wrong is an opinion,
not a fact.