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: Nathan Sidwell <nathan at codesourcery dot com>
- To: Nathan Sidwell <nathan at codesourcery dot com>
- Cc: Mike Stump <mstump at apple dot com>, Mike Stump <mrs at apple dot com>, Gabriel DosReis <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: Wed, 19 Feb 2003 17:34:30 +0000
- Subject: Re: static const double pi = 3.1415;
- Organization: Codesourcery LLC
- References: <46BEE41F-442D-11D7-B22E-003065A77310@apple.com> <3E53BE18.4070400@codesourcery.com>
Nathan Sidwell wrote:
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).
bzzt!
they have to be constant expressions in C, but the constraints are more
relaxed and may be evaluated at runtime (C99 [6.7.8]/4 and [6.6]/2,3,4)
In C++ they can be arbitrary expressions (C++ [8.5]/2)
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
The voices in my head said this was stupid too
nathan at codesourcery dot com : http://www.cs.bris.ac.uk/~nathan/ : nathan at acm dot org