Topic: Some questions on the decltype/auto proposal.
Author: serikas@gmail.com (Hwang, Sung Jin)
Date: Wed, 27 Apr 2005 05:55:02 GMT Raw View
1. For decltype, what happened to the common name typeof?
Isn't typeof consistent with sizeof operator?
2. I am glad that a proposal for specifying return type of
a function at the tail of a function declaration.
But... do compilers need a keyword ahead of function
declarations to parse them correctly? (The proposal placed
the 'auto' keyword.)
In addition why does the proposal use operator-> to
specify the return type? isn't 'return' keyword better?
There would be no parsing problems with using 'return' keyword
and it would be more intuitive.
To me, the proposal is weird. Does anyone know why?
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]
Author: francis@robinton.demon.co.uk (Francis Glassborow)
Date: Wed, 27 Apr 2005 18:31:12 GMT Raw View
In article <198ea225.0504260056.1006d7ef@posting.google.com>, "Hwang,
Sung Jin" <serikas@gmail.com> writes
>1. For decltype, what happened to the common name typeof?
> Isn't typeof consistent with sizeof operator?
>
>2. I am glad that a proposal for specifying return type of
> a function at the tail of a function declaration.
>
> But... do compilers need a keyword ahead of function
> declarations to parse them correctly? (The proposal placed
> the 'auto' keyword.)
>
> In addition why does the proposal use operator-> to
> specify the return type? isn't 'return' keyword better?
> There would be no parsing problems with using 'return' keyword
> and it would be more intuitive.
>
> To me, the proposal is weird. Does anyone know why?
The answer to all your questions come down to:
1) Investigating the concepts for which 'typeof' has been used revealed
that there are several concepts in the bundle which need to be teased
apart. Using typeof for just one of them was just going to sow confusion
among people who are currently using some variety of 'typeof' extension.
2) C++ is already a fiercely difficult language to parse so adding clues
for the parser can be of considerable help. The problem isn't in parsing
correct code but identifying incorrect code (and if you want to see how
bad that can get, look at error messages that result from template use)
3)The exact syntax has not yet been settled (it takes much longer than
some people expect because we are trying to ensure that the final result
is clear and easy to use)
--
Francis Glassborow ACCU
Author of 'You Can Do It!' see http://www.spellen.org/youcandoit
For project ideas and contributions: http://www.spellen.org/youcandoit/projects
---
[ 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.jamesd.demon.co.uk/csc/faq.html ]