D
Dave Thompson
On 16 May 2005 23:33:16 GMT, (e-mail address removed) (Michael Wojcik)
wrote:
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
wrote:
There was a half-serious proposal maybe a year ago or so for 'auto' toAnd it's high time the committee did something about that, too. Quick,
someone invent a new use for "auto".
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