static const double pi = 3.1415;

Mike Stump mstump@apple.com
Thu Feb 20 19:52:00 GMT 2003


On Thursday, February 20, 2003, at 02:55 AM, Nathan Sidwell wrote:
>> I still feel like I am on Mars:
> I suspect we have not defined the 'argument' (A sequence of statements 
>  that's not an argument, you're merely contradicting me ...)

I don't want to argue...  I just wanted to get across the point that 
for:

double bar();

static const double d = 3.1415;

void foo(double);
int main() {
         foo(d);
}

a compiler of C is must understand and translate this, and that for C++ 
a compiler must understand and translate this, and that the compiler is 
free to generate the same code for it, if it wants to.

Using the those well defined semantics, whatever they are, and however 
they are defined for each language, I want to argue that whether or not 
we accept static const double d = 3.1415 in a class as a member, is 
arbitrary and not based upon the `gosh, it is just too complex', or 
some other argument based upon floating point being qualitatively 
different from int or enums.  That being said, a restriction against 
floating point in this context is arbitrary (and wrong).

> Care to file a Defect Report? (Maybe there already is one)

Wish I felt like I had the time...  Maybe I can get Matt to do the 
dirty work...  :-)



More information about the Gcc mailing list