This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: C++ PATCH: Disallow floating-point literals in integral-constant expressions
- From: Tom Tromey <tromey at redhat dot com>
- To: Ranjit Mathew <rmathew at gmail dot com>
- Cc: Mark Mitchell <mark at codesourcery dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, GCJ Patches <java-patches at gcc dot gnu dot org>
- Date: 01 Feb 2005 11:17:03 -0700
- Subject: Re: C++ PATCH: Disallow floating-point literals in integral-constant expressions
- References: <200502010102.j1112IsD021436@sethra.codesourcery.com><41FF1AFD.20306@gmail.com> <41FF1CE6.5090904@codesourcery.com><39399b9d05013122166361305c@mail.gmail.com><41FF1FDA.4040307@codesourcery.com><39399b9d0502010138606a3a2d@mail.gmail.com>
- Reply-to: tromey at redhat dot com
>>>>> "Ranjit" == Ranjit Mathew <rmathew@gmail.com> writes:
Ranjit> It is "bogus" in the sense that it just disables
Ranjit> the initialisation for static final real fields for
Ranjit> CNI (and not JNI).
I think this is what we want. If C++ doesn't allow this, then it
simply doesn't. I don't think it is critical for us.
Please commit this patch.
Ranjit> That said, I am not completely sure of the
Ranjit> mechanics of the original code either - the
Ranjit> final (const) field would have been initialised
Ranjit> by the "Java side" too - so why do we need
Ranjit> to initialise it in C++? I'm sure I'm missing
Ranjit> something...
A 'static final' field of primitive type whose initializer is a
constant expression is a compile-time constant (and is inlined into
classes compiled against it). We wanted to expose this to CNI as
well. (In Java, String-typed fields also fall into this category, but
we didn't pursue that for CNI, since Strings have a non-trivial
representation.)
As far as I know libgcj itself only really uses this feature for
integral constants, in particular the various values in Modifier.
Tom