Problem with the online CNI manual
Nic Ferrier
nferrier@tapsellferrier.co.uk
Fri Jan 25 05:56:00 GMT 2002
I'm finding the CNI manual a bit confusing, I think there are some
misleading bits.
The page titled: Methods includes the following:
*Object Constructors*
Constructors are called implicitly as part of object allocation
using the new operator.
For example:
java::lang::Int x = new java::lang::Int(234);
.
.
.
But I think this is wrong isn't it? The next page, "Object Allocation"
suggests it should be this:
java::lang::Int *x = new java::lang::Int(234);
And from what I remember from my C++ years (which is some time ago now
I have to confess) that is correct, new is like malloc and therefore
returns a pointer to the object, not the object itself.
I don't know if it's possible to rely on other C++ allocation
mechanisms for java classes, eg: could one do this:
void
somepackage::SomeClass ()
{
// Automatic allocation of ht.
::java::util::Hashtable ht = ::java::util::Hashtable ();
ht.put (JvNewStringLatin1 ("key"),
JvNewStringLatin1 ("value"));
// ht is automatically destroyed when scope is left.
}
Also, it would be great if the CNI reference was included in the GCJ
documentation, maybe as an appendix or something.
That would require that the GCJ manual was re-written in info unless
anyone is aware of a docbook->info stylesheet? (the CNI manual is in
docbook/sgml right now).
Would anyone like me to start that process?
Nic
More information about the Java
mailing list