static const double pi = 3.1415;
Mike Stump
mstump@apple.com
Thu Feb 20 20:38:00 GMT 2003
On Wednesday, February 19, 2003, at 10:14 AM, Mark Mitchell wrote:
>> On Tuesday, February 18, 2003, at 11:59 AM, Mark Mitchell wrote:
>>> OK, Mike, let's see your patch. :-)
I'm sorry, I think I confused two different things, though, I don't
quite know how I did that.
The real code was:
class A {
static const char *name = "hi";
} a;
which has all the same arguments as float, though, float is allowed, as
you point out. -pedantic-errors kills the ability to use 3.1415 as a
value of pi, one must use 3 as the approximation of pi to make it
compile. :-( In some fields that's fine, but in general, this is bad.
ANSI C++ should be fixed to allow 3.1415, we should allow it by
default, and we do, so no change is necessary for it.
g++ should just pedwarn for static const char *, as it is a good
extention, g++ has had it forever, and eventually we will fix the
Standard to allow it. My patch adds this pedwarn for it. Strict
conformance is retained, and an error is produced, if people want it
that way (via -pedantic-errors).
Hope that clarifies it.
More information about the Gcc
mailing list