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: "gdr at integrable-solutions dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Feb 2005 15:57:47 -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 gdr at integrable-solutions dot net 2005-02-01 15:57 -------
Subject: Re: gcjh generates invalid class member floating-point initialisers
"rmathew at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| A patch to avoid this error is at:
|
| http://gcc.gnu.org/ml/java-patches/2005-q1/msg00255.html
|
| Note that the correct way to initialise a
| const float is apparently:
|
| class Foo
| {
| static const float bar;
| }
|
| const float ::Foo::bar = 123.456f;
|
| If gcjh were to be modified to generate
| code like this in the headers, we get
| multiple definition errors from the linker
| when two or more files #include the
| generated file.
Put the initializations (the real definition) in a .C file
(e.g. implementation file). As someone said eight years ago, that
special rule is a misfeature.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19738