 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
ltsnyder Guest
|
Posted: Thu Aug 26, 2004 7:45 am Post subject: type specifier not required? |
|
|
As far as I have been told the ISO C++ standard says this is valid but
I can not find the section of the standard that says this is valid.
const testsize = 10;
gnu c++ does not support this , and I am happy, but does the ISO C++
Standard document latest release 2003 say this is valid? i.e. a
declaration with out explicitly declaring the type?
Any help is greatly appreciated.
-Lee
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Sharad Kala Guest
|
Posted: Fri Aug 27, 2004 2:56 am Post subject: Re: type specifier not required? |
|
|
"ltsnyder" <LTSnyder (AT) x3ci (DOT) com> wrote in message
| Quote: | As far as I have been told the ISO C++ standard says this is valid but
I can not find the section of the standard that says this is valid.
const testsize = 10;
gnu c++ does not support this , and I am happy, but does the ISO C++
Standard document latest release 2003 say this is valid? i.e. a
declaration with out explicitly declaring the type?
|
The "implicit int" rule of C is no longer supported in ISO C++. Hence the
above code is illegal.
Section 7.1.5/2 reads -
"At least one type-specifier that is not a cv-qualifier is required in a
declaration unless it declares a constructor,
destructor or conversion function."
-Sharad
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Victor Bazarov Guest
|
Posted: Fri Aug 27, 2004 11:01 am Post subject: Re: type specifier not required? |
|
|
"ltsnyder" <LTSnyder (AT) x3ci (DOT) com> wrote...
| Quote: | As far as I have been told the ISO C++ standard says this is valid but
I can not find the section of the standard that says this is valid.
const testsize = 10;
gnu c++ does not support this , and I am happy, but does the ISO C++
Standard document latest release 2003 say this is valid? i.e. a
declaration with out explicitly declaring the type?
|
No, it does not. Moreover, it says that it's invalid. See 7.1.5/2.
Victor
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Jack Klein Guest
|
Posted: Fri Aug 27, 2004 11:04 am Post subject: Re: type specifier not required? |
|
|
On 26 Aug 2004 03:45:24 -0400, [email]LTSnyder (AT) x3ci (DOT) com[/email] (ltsnyder) wrote in
comp.lang.c++.moderated:
| Quote: | As far as I have been told the ISO C++ standard says this is valid but
I can not find the section of the standard that says this is valid.
const testsize = 10;
gnu c++ does not support this , and I am happy, but does the ISO C++
Standard document latest release 2003 say this is valid? i.e. a
declaration with out explicitly declaring the type?
Any help is greatly appreciated.
-Lee
|
I don't have a copy of the 2003 update handy, so this is a copy and
paste from the original 1998 version. So the numbers might have
changed.
========
[dcl.type] 7.1.5 Type specifiers
[snip]
2 At least one type-specifier that is not a cv-qualifier
is required in a declaration unless it declares a constructor,
destructor or conversion function.80)
========
And footnote 80, referred to above, elaborates. Footnotes are not
normative per se, but are intended to clarify or amplify the normative
text:
========
80) There is no special provision for a decl-specifier-seq that lacks
a type-specifier or that has a type-specifier that only specifies
cv-qualifiers. The “implicit int” rule of C is no longer supported.
========
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
llewelly Guest
|
Posted: Sat Aug 28, 2004 10:55 am Post subject: Re: type specifier not required? |
|
|
Jack Klein <jackklein (AT) spamcop (DOT) net> writes:
[snip]
| Quote: | I don't have a copy of the 2003 update handy, so this is a copy and
paste from the original 1998 version. So the numbers might have
changed.
|
In this specific case, the 2003 and 1998 standards are identical.
In general, I believe the committee went to much trouble to ensure
the section, paragraph, and footnote number remained the same in
both 1998 and 2003 standards.
| Quote: |
========
[dcl.type] 7.1.5 Type specifiers
[snip]
2 At least one type-specifier that is not a cv-qualifier
is required in a declaration unless it declares a constructor,
destructor or conversion function.80)
========
And footnote 80, referred to above, elaborates. Footnotes are not
normative per se, but are intended to clarify or amplify the normative
text:
========
80) There is no special provision for a decl-specifier-seq that lacks
a type-specifier or that has a type-specifier that only specifies
cv-qualifiers. The “implicit intâ€� rule of C is no
longer supported.
========
[snip] |
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|