YA Socket timeout patch

Bryce McKinlay bryce@waitaki.otago.ac.nz
Sun Dec 16 15:55:00 GMT 2001


Nic Ferrier wrote:

>>I don't agree. In this case there is no superclass that is going to mess 
>>with the value, it is safe and more efficient to not explicitly 
>>initialize it. I'd prefer if you removed them.
>>
>
>Safer to not initialize? How can it be safe to not initialize? I don't
>understand your issue here really, if it does cause increased size
>it's only tiny... Surely it's better to have explicit initialization
>and pay for the very small increase?
>

It is safe to not initialize because Java guarantees that all fields 
will always be initialized to 0 or null. However as Eric pointed out, 
its not safe for the *compiler* to optimize away such initializations 
because the possibility exists that a superclass initializer could 
somehow set the value before your initializer is run. In this case we 
know that can never happen!

regards

Bryce.




More information about the Java-patches mailing list