From 2028948662169985367
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,74637d148a591f02
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2001-03-26 08:47:29 PST
Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!news.iac.net!news-out.cwix.com!newsfeed.cwix.com!newsfeeds.belnet.be!news.belnet.be!btnet-peer1!btnet-peer0!btnet!dispose.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: marco@technoboredom.net (Marco Manfredini)
Newsgroups: comp.std.c++
Subject: Re: Proposal: two real uses for the "auto" keyword
Date: Mon, 26 Mar 2001 16:45:03 GMT
Organization: YoYoDyne Propulsion Systems
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <Xns90705A5C9D09Cmarcotechnobore@technoboredom.net>
References: <052201c0b4ab$603e8050$0500a8c0@dragonsys.com> <99l3nf$7n0$1@news-int.gatech.edu>
X-Trace: mail2news.demon.co.uk 985625108 mail2news:27262 mail2news mail2news.demon.co.uk
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Sender: 520006876397-0001@t-dialin.net
User-Agent: Xnews/M3
X-Love-Love-Love-LaLaLove-LaLaLove: Makes-The-World-GoAround.
Lines: 48
Xref: supernews.google.com comp.std.c++:4010

gt5163b@prism.gatech.edu (Brian McNamara!) wrote in
<99l3nf$7n0$1@news-int.gatech.edu>: 


>Third: Is there a way to add cv-qualifiers or reference-ness?  In
>other words, can I do something like
>   auto const& tmp = (a+b)/(c-d);
>This would also be nice, as well as potentially more practical for
>some of the intended uses.  (There aren't any "implicit int"s left
>in the language trying to get in the way, are there?)

I think auto could be positioned as a placeholder for the right-hand 
type. Such that: 
{X}={Y}; 

can be rewritten as 

{X/auto=typeof(Y)}=Y;

In that case cv would come up quite naturally, like: 

const auto & tmp = (a+b)/(c-d); 

Anything else looks more complicated, since whatever type I declare on 
the lhs, it must be initializable with the rhs.

>
>I thought my 
>   Error<compile_time_bool,"User defined conditional error message">
>idea was good--but this one is even better!  If any compiler
>implementor adds both this extension and my user-defined error
>messages idea, I will be happy to purchase that compiler and quit
>using g++, even if I have to pay out the nose.  I am dying for these
>features! 
>

g++ already has typeof() and I think that auto can be hacked into it 
easily (for someone who is into the source).

-- 
Marco

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]



