Topic: da phect: typedef in function definition


Author: "Alf P. Steinbach" <alfps@start.no>
Date: Wed, 1 Apr 2009 17:08:18 CST
Raw View
The n2800 draft standard, like the C++98 standard, cheerfully informs us
that


       7.1.3/1 "The typedef specifier shall not be used in a function-
             definition (8.4), ..."


Well hello.

One might imagine that what was intended was... Well, something. But the
wording
as-is disallows e.g.

    int main() { typedef int Int; }

And I gather that couldn't very well be the intention.

Suggested rewording:


      [Suggested rewording]
       7.1.3/1 "The typedef specifier shall not be used in the
/decl-specifier-seq/
             of a function-definition (8.4), ..."


Cheers,

- Alf

PS: I no longer remember the rules for defect reports, and as I recall
earlier
when such was submitted and not 100% rule-conforming it was rejected, so
I just
wrote "da phect". Hopefully that's OK? We're all hip hoppers, right? :-)

--
Due to hosting requirements I need visits to <url:
http://alfps.izfree.com/>.
No ads, and there is some C++ stuff! :-) Just going there is good. Linking
to it is even better! Thanks in advance!


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





Author: "Ivan A. Kosarev" <ik@unicals.com>
Date: Fri, 3 Apr 2009 10:54:25 CST
Raw View
Alf P. Steinbach wrote:
> The n2800 draft standard, like the C++98 standard, cheerfully informs us
> that
>       7.1.3/1 "The typedef specifier shall not be used in a function-
>             definition (8.4), ..."

It's fixed in N2857; see issue 576.

--


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





Author: Jiang <goo.mail01@yahoo.com>
Date: Sat, 4 Apr 2009 09:50:28 CST
Raw View
On Apr 2, 8:08 am, "Alf P. Steinbach" <al...@start.no> wrote:
> The n2800 draft standard, like the C++98 standard, cheerfully informs us
> that
>
>        7.1.3/1 "The typedef specifier shall not be used in a function-
>              definition (8.4), ..."
>
> Well hello.
>
> One might imagine that what was intended was... Well, something. But the
> wording
> as-is disallows e.g.
>
>     int main() { typedef int Int; }
>
> And I gather that couldn't very well be the intention.

True, that is not the intention, please check the defect report 576:

576. Typedefs in function definitions
@
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#576

Regards,

Jiang


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