Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2002-02-21 11:10:06


----- Original Message -----
From: "Peter Dimov" <pdimov_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, February 21, 2002 12:53 PM
Subject: Re: [boost] More on auto

> 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.

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 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 ;
}

Which is the same as arguing that detecting the possible presence of
implicit conversions are not worst the trouble of having dummy type names.

Well, we could strip type names from template arguments all together then...

Fernando Cacciola
Sierra s.r.l.
fcacciola_at_[hidden]
www.gosierra.com


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