Why not auto?

  • Thread starter Vijay Kumar R. Zanvar
  • Start date
D

Dave Thompson

On 16 May 2005 23:33:16 GMT, (e-mail address removed) (Michael Wojcik)
wrote:
And it's high time the committee did something about that, too. Quick,
someone invent a new use for "auto".
There was a half-serious proposal maybe a year ago or so for 'auto' to
declare a variable with the same type as an expression without having
to (be able to) state that type, for things like the GNUC classic
#define SWAP(x,y) { typeof(x) _temp = x; x = y; y = _temp; }
/* or probably better the do...while(0) hack or the GNUC ({ }) hack */
which would now be something like { auto _temp = x; etc. }

C++ templates can already do this in (all?) useful cases.

- David.Thompson1 at worldnet.att.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,164
Messages
2,570,898
Members
47,439
Latest member
shasuze

Latest Threads

Top