Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-02-21 11:28:26


From: "Fernando Cacciola" <fcacciola_at_[hidden]>
> From: "Peter Dimov" <pdimov_at_[hidden]>
> > From: "Fernando Cacciola" <fcacciola_at_[hidden]>
> > > I don't think that the very small increased complexity of requiring
auto
> > > declarations to have a type name are not worth the increased safety.
> > > Don't you think it does improves safety a lot?
> >
> > No, actually, I don't. Partly because the right time to use auto
> > declarations is exactly when the actual type doesn't matter, and partly
> > because I don't see how requiring a dummy identifier would improve
safety
> > somehow.
> >
> I think your are assuming too much about how 'auto' would end up being
used.

No, I don't assume anything.

> Unless you are considering that auto variables MUST only be used in very
> restrictive contexts (in which way I'd like to see how that would be
> enforced);

By a coding standard, presumably. You can already write unreadable code if
you want to.

> by the same reasoning by which you would be comfortable with
> type-nameless auto variables you would be just the same comfortable with
> type nameless template arguments:
>
> That is, it appears from your arguments that this:
>
> template<class,class,class> foo(a,b,c)
> {
> d = a + b -c ;
> return d > 0 ;
> }
>
> isn't any more safe than this:
>
> template<class T,class U,class V> bool foo(T a,U b,V c)
> {
> typeof(T+U-V) d = a + b -c ;
> return d > 0 ;
> }

I fail to see the analogy or the connection with "my arguments."

Please answer the question above, which is: how, exactly does this:

auto X x = expr;

provide more safety than

auto x = expr;


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk