This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Re: C++ and Java CNI: Check Java references


Andrew Haley <aph@cambridge.redhat.com> writes:

> The semantics of Java require dereferencing a null pointer to an
> object to throw a NullPointerException.  We already generate code to
> do this in the Java compiler; this patch is for CNI code that is
> written in C++.

I'm not sure this is a good idea.  The goal is CNI is to write C++
code that works with Java objects and make it convenient to write
Java native methods; the goal is not to write Java with C++ syntax.
We've put in various hacks in cc1plus to make it convenient to
access Java objects from C++, so to some extent the actual generated
code is different from the source.  However, explicit null-pointer
checking seems to stretch the boundary of appropriate magic re-writes.

If null-pointer checking in C++ code makes sense, what makes this
feature Java-specific?  (Except that it calls  libjava routine.)
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/


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