[Bug java/19738] gcjh generates invalid class member floating-point initialisers
giovannibajo at libero dot it
gcc-bugzilla@gcc.gnu.org
Tue Feb 1 12:36:00 GMT 2005
------- 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
More information about the Gcc-bugs
mailing list