Boost logo

Boost :

Subject: Re: [boost] usage of auto in tutorials
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2019-03-19 21:08:12

wt., 19 mar 2019 o 21:10 Robert Ramey via Boost <boost_at_[hidden]>

> On 3/19/19 8:49 AM, Andrzej Krzemienski via Boost wrote:
> > I wonder what others in this group think? Maybe we could come up with
> some
> > guidelines for documentation writers.
> >
> > Regards,
> > &rzej;
> >
> FWIW - my personal rule is to never use auto.
> The type conveys information. I think hiding information is a bad idea
> in general. (note before anyone complains: hiding information is not
> the same as abstracting and interface).
> auto is hack to permit one to work around some unfortunate situation
> which might occur while engaged in Template MetaProgramming. I haven't
> kept track, but I've found it necessary in probably less than 10 cases
> over the years.
> (Almost) Never use auto!)
> I subscribe to rule "almost never auto"; but by this I mean "do not use
type inference when you can spell out your type explicitly".

I never suspected that the feature known as "trailing return type", like

auto Class::fun() -> value_type;

would be questioned as unfit for tutorials. I am quite surprised that in
Stephan's environment "auto" is banned regardless if it is used for type
inference or for trailing return types.


Boost list run by bdawes at, gregod at, cpdaniel at, john at