static const double pi = 3.1415;

Nathan Sidwell nathan@codesourcery.com
Wed Feb 19 17:37:00 GMT 2003


Mike Stump wrote:

> Seems like I am just too radical for ya'll:
> 
 > static const double d = 3.1415;
 >
 > int main() {
 >         foo(d);
 > }
 > static const double d = 3.1415;

> 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.

We were talking about static *member* constants, not plain static
constants. The latter are well formed (they do not have to be initialized
by a constant expression).

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
          The voices in my head said this was stupid too
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org




More information about the Gcc mailing list