static const double pi = 3.1415;
Mike Stump
mstump@apple.com
Wed Feb 19 17:34:00 GMT 2003
On Wednesday, February 19, 2003, at 08:52 AM, Nathan Sidwell wrote:
> Mike Stump wrote:
>> Personally, I don't find
>> int i = 1;
>> to be substantially different from:
>> double i = 1;
>> :-( As far as extensions go, I've seen worse.
> you also have to extend the meaning of a constant-expression. [9.4.2]
Seems like I am just too radical for ya'll:
static const double d = 3.1415;
int main() {
foo(d);
}
I asked my C compiler, it like it, it knew what it meant, it knew how
to optimize it, it _liked_ it, and until we make that an error... I
don't think C++ should be radically different, anyway, I've already
agreed with Gaby that the better forum is the C++ committee, and I'm
content to not push the issue here. I've already yelped, and that's
all I'm gonna do.
> says
> that the initializer for a static int member must be a constant
> integral
> expression. To allow float you'd have to define what a constant float
> expression is, and that'd mean you'd have to define how to do float
> arithmetic at compile time. Not that any of that is insurmountable,
> but you need to define it.
The above C program seemed to work in C++ as well. Either, that is a
bug in C and C++, or somewhere, it is defined well enough to work.
More information about the Gcc
mailing list