This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug java/19738] gcjh generates invalid class member floating-point initialisers
- From: "giovannibajo at libero dot it" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Feb 2005 12:36:17 -0000
- Subject: [Bug java/19738] gcjh generates invalid class member floating-point initialisers
- References: <20050201065958.19738.rmathew@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From giovannibajo at libero dot it 2005-02-01 12:36 -------
Yes. Notice that also this code:
struct A
{
static const int a = 45;
};
is invalid without a matching definition. That is, you need to provide a single
definition of:
const int A::a;
which obviously cannot be put in a header file. If you wonder why you need a
definition, consider what happens if some user code does "&A::a", which is of
course legal. Or think that to load a floating point constant into the CPU we
need to fetch it from memory (which address if you don't provide a definition?)
In fact, I personally use this to expose constants without linkage:
struct A {
enum { a = 45 };
};
but with floating point numbers you are out of luck.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19738