This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ and Java CNI: Check Java references
- To: Andrew Haley <aph at cambridge dot redhat dot com>
- Subject: Re: C++ and Java CNI: Check Java references
- From: Per Bothner <per at bothner dot com>
- Date: 23 Apr 2001 12:28:46 -0700
- Cc: java at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- References: <15076.30828.158320.599505@cuddles.cambridge.redhat.com>
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/