Topic: is this a valid float?


Author: James Kanze <james-albert.kanze@vx.cit.alcatel.fr>
Date: 1997/03/12
Raw View
Vik Heyndrickx <Vik.Heyndrickx@rug.ac.be> writes:

|>  Hi to you all,
|>
|>  Are the following character sequences valid (C/C++) float literals?
|>
|>   03158.216
|>   078e25
|>
|>  In my opinion they are. But why do some compilers then complain they are
|>  invalid octal constants? Obviously the problem is the leading '0',
|>  however the C++ standard does say that the longest character sequence
|>  has to be taken in account.
|>
|>  Any comments?

Such compilers are broken.  The above are valid floating point literals.

--
James Kanze      home:     kanze@gabi-soft.fr        +33 (0)1 39 55 85 62
                 office:   kanze@vx.cit.alcatel.fr   +33 (0)1 69 63 14 54
GABI Software, Sarl., 22 rue Jacques-Lemercier, F-78000 Versailles France
     -- Conseils en informatique industrielle --
---
[ 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         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]





Author: Vik Heyndrickx <Vik.Heyndrickx@rug.ac.be>
Date: 1997/03/11
Raw View
Hi to you all,

Are the following character sequences valid (C/C++) float literals?

 03158.216
 078e25

In my opinion they are. But why do some compilers then complain they are
invalid octal constants? Obviously the problem is the leading '0',
however the C++ standard does say that the longest character sequence
has to be taken in account.

Any comments?
---
[ 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         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]