This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH: Disallow floating-point literals in integral-constant expressions

>>>>> "Ranjit" == Ranjit Mathew <> 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

As far as I know libgcj itself only really uses this feature for
integral constants, in particular the various values in Modifier.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]