You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Kev Jackson <ke...@it.fts-vn.com> on 2004/12/09 07:43:02 UTC

[Patch] small changes to CBZip2*

just some minor tweaks
- noticed two loops looping over same range with independent code, 
combined them
- removed unneccessary casts from int to int (I left in casts from char 
to int as the code may rely on these casts in some obscure way, I 
guessed that a cast from int to int was truly unneccesary though)
- use FileUtils to close stream

question:
Do we assume that when arrays are initialised they have an undefined value?
eg:
boolean[] test = new array[10];

test[0] == null?

Reading VM spec suggests that a boolean is initialised to false and that 
was my understanding too, but does this behaviour change when an array 
of primitives is created?  I'm pretty sure it doesn't, but it may be a 
VM vendor issue so I left in the code that looped across arrays and set 
them all to false in case a particular VM doesn't do this.

http://java.sun.com/docs/books/vmspec/2nd-edition/html/Concepts.doc.html#15858

Kev


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: [Patch] small changes to CBZip2*

Posted by Jesse Glick <je...@sun.com>.
Kev Jackson wrote:
> question: Do we assume that when arrays are initialised they have an
> undefined value?

Java requires newly created arrays to be filled with null/0/false acc. 
to type. There is no need to explicitly blank it.

http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#23605
http://java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html#96595

-J.

-- 
Jesse Glick <ma...@sun.com> x22801
NetBeans, Open APIs  <http://www.netbeans.org/>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org