This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: static const double pi = 3.1415;
- From: Mike Stump <mstump at apple dot com>
- To: Nathan Sidwell <nathan at codesourcery dot com>
- Cc: Mike Stump <mrs at apple dot com>, Gabriel Dos Reis <gdr at integrable-solutions dot net>, Mark Mitchell <mark at codesourcery dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Thu, 20 Feb 2003 10:42:41 -0800
- Subject: Re: static const double pi = 3.1415;
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... :-)