Thread View: comp.lang.c.moderated
7 messages
7 total messages
Started by rdwells
Thu, 04 Apr 1996 01:08
Is 300F a valid float constant?
Author: rdwells
Date: Thu, 04 Apr 1996 01:08
Date: Thu, 04 Apr 1996 01:08
19 lines
1043 bytes
1043 bytes
VC++ rejects 300F as a float constant, but my reading of
the syntax part of section 6.1.3.1 of the standard indicates
that it should be valid:
300 is a valid digit-sequence
a digit-sequence alone is a valid fractional-constant
F is a valid floating-suffix
a fractional-constant followed by a floating-suffix is
a valid floating-constant
However, the description part of section 6.1.3.1 says:
"...either the period or the exponent part shall be
present"
which would indicate to me that 300F is not valid.
Am I reading the syntax wrong? Should I take this to
comp.std.c where someone may actually care (:-)?
Re: Is 300F a valid float constant?
Author: Thad Smith
Date: Fri, 05 Apr 1996 00:51
Date: Fri, 05 Apr 1996 00:51
13 lines
944 bytes
944 bytes
In article <4jv7es$d2i@solutions.solon.com>, rdwells@mmm.com wrote: >VC++ rejects 300F as a float constant, but my reading of >the syntax part of section 6.1.3.1 of the standard indicates >that it should be valid: > > 300 is a valid digit-sequence > a digit-sequence alone is a valid fractional-constant You must have one of the flawed copies of the ANSI/ISO standard. In the definition of fractional-constant there is a period after digit-sequence (at least in the ANSI original). Thad
Re: Is 300F a valid float constant?
Author: Lawrence Kirby
Date: Sat, 06 Apr 1996 14:41
Date: Sat, 06 Apr 1996 14:41
36 lines
1697 bytes
1697 bytes
In article <4jv7es$d2i@solutions.solon.com> rdwells@mmm.com writes:
>VC++ rejects 300F as a float constant, but my reading of
>the syntax part of section 6.1.3.1 of the standard indicates
>that it should be valid:
>
> 300 is a valid digit-sequence
> a digit-sequence alone is a valid fractional-constant
No, it isn't. In some copies of the standard (such as that in Schildt) there
is an error in that section. It should read:
fractional-constant
digit-sequence . digit-sequence
opt
digit-sequence .
Note the final . which is correctly stated in appendix B.1.4
...
>However, the description part of section 6.1.3.1 says:
>
> "...either the period or the exponent part shall be
> present"
>
>which would indicate to me that 300F is not valid.
300 can't be both a valid floating-constant and integer-constant or the
grammar would be ambiguous.
--
-----------------------------------------
Lawrence Kirby | fred@genesis.demon.co.uk
Wilts, England | 70734.126@compuserve.com
-----------------------------------------
Re: Is 300F a valid float constant?
Author: rdwells
Date: Sat, 06 Apr 1996 14:41
Date: Sat, 06 Apr 1996 14:41
27 lines
1537 bytes
1537 bytes
Thad Smith wrote: > > In article <4jv7es$d2i@solutions.solon.com>, rdwells@mmm.com wrote: > >VC++ rejects 300F as a float constant, but my reading of > >the syntax part of section 6.1.3.1 of the standard indicates > >that it should be valid: > > > > 300 is a valid digit-sequence > > a digit-sequence alone is a valid fractional-constant > > You must have one of the flawed copies of the ANSI/ISO standard. In > the definition of fractional-constant there is a period after > digit-sequence (at least in the ANSI original). Thanks much for the clarification. Is this one of those examples of what I get for trusting the text of the ANSI standard in Schildt's book? [No. This bug existed in the ISO standard when Schildt got a copy. Note: ISO, not ANSI. ISO's fault. -mod] (Or do I lose my c.l.c.moderated posting privileges for even admitting that I own (and use (the left-hand pages of)) a copy?) [I do too. The annotations can be sort of amusing, actually; it's like reading those "best of student bloopers" things. -mod]
Re: Is 300F a valid float constant?
Author: Walter Murray
Date: Tue, 09 Apr 1996 22:42
Date: Tue, 09 Apr 1996 22:42
29 lines
1537 bytes
1537 bytes
rdwells@mmm.com wrote: : VC++ rejects 300F as a float constant, but my reading of : the syntax part of section 6.1.3.1 of the standard indicates : that it should be valid: [snip] : Am I reading the syntax wrong? Should I take this to : comp.std.c where someone may actually care (:-)? You are the victim of a typo in the ANSI version of the standard. (You'd think, as much as we have to pay to get an ANSI standard, that the quality of the reproduction would be better!) In the second form of the syntax for a fractional-constant in 6.1.3.1, digit-sequence should be followed by a period. Then the comment that you quoted makes sense. If you have doubts, check the syntax summary in Annex B (Subclause B.1.4), which does not have the typo. Perhaps you are using Schildt's annotated version of the standard. If so, don't blame this on him. This error occurs in the ANSI document itself. I'd like to know whether anyone has reported it through official channels. Walter Murray Hewlett-Packard Support Technology Lab
Re: Is 300F a valid float constant?
Author: Miguel Carrasquer Vidal
Date: Fri, 12 Apr 1996 12:27
Date: Fri, 12 Apr 1996 12:27
21 lines
1234 bytes
1234 bytes
walterm@hprctbs3.rose.hp.com (Walter Murray) wrote: >You are the victim of a typo in the ANSI version of the >standard. [..] > >Perhaps you are using Schildt's annotated version of the >standard. If so, don't blame this on him. This error >occurs in the ANSI document itself. Not Schildt's fault maybe, but should an annotated edition not have mentioned the fact that there is a typo in the standard? Doing that would at least give the reader the feeling that the annotator has actually read what he's annotating. == Miguel Carrasquer Vidal ~ ~ Amsterdam _____________ ~ ~ mcv@pi.net |_____________||| ========================== Ce .sig n'est pas une .cig
Re: Is 300F a valid float constant?
Author: Walter Murray
Date: Sat, 13 Apr 1996 02:28
Date: Sat, 13 Apr 1996 02:28
15 lines
1118 bytes
1118 bytes
It was written: : > You must have one of the flawed copies of the ANSI/ISO standard. In : > the definition of fractional-constant there is a period after : > digit-sequence (at least in the ANSI original). : [This bug existed in the ISO standard when Schildt got : a copy. Note: ISO, not ANSI. ISO's fault. -mod] What about copies of the ISO standard distributed by the standards bodies in countries other than the U.S.? When this came up before, I got the impression that only the ANSI edition of the ISO standard had this typo. Walter Murray
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads