instanceof in CNI

Tom Tromey tromey@cygnus.com
Sat Mar 25 08:23:00 GMT 2000


>> Is there anything similar to the Java instanceof operatior in C++/CNI?

Bryce> You can use _Jv_IsInstanceOf(object, class)

Usually we recommend only using "Jv" functions and not "_Jv_"
functions.  The former are exported and the latter are not.

I recommend using Class::isInstance.

Bryce> To get a reference to a Class object to compare against, you
Bryce> currently have to use Class::forName(), or compare against the
Bryce> mangled symbolic class name directly. This is something we're
Bryce> looking at addressing soon in gcjh.

Lately I've been thinking gcjh could generate a per-class inline
function named something like "$class"; I got this idea because
apparently javac generates an internal function named "class$" to
implement the ".class" notation.

Comments?  Naming here is the big problem, as I see it.

Tom


More information about the Java mailing list