Problem with the online CNI manual

Bryce McKinlay bryce@waitaki.otago.ac.nz
Fri Jan 25 12:44:00 GMT 2002


Nic Ferrier wrote:

>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);
>

You're right, the first example is wrong.

>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.
>  }
>

Off-hand I don't know if this will work: I suspect it wont. Finalizers 
etc certainly wont because the allocation will not go through the GC.

>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?
>

Yes. The CNI manual, amongst other things, should really be integrated 
into gcj.texi.

regards

Bryce.




More information about the Java mailing list