[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: redundant field initializers
From: |
Chris Gray |
Subject: |
Re: redundant field initializers |
Date: |
Mon, 20 Sep 2004 23:11:41 +0200 |
User-agent: |
KMail/1.5.4 |
On Monday 20 September 2004 22:42, Per Bothner wrote:
> Mark Wielaard wrote:
> > Why would a compiler emit extra initialization code for default values
> > for fields? Not that I object to removing them, but it looks like the
> > compiler emits unnecessary code in this case.
>
> One can construct torture cases where the semantics are different, for
> both static and instance fields, if some code change the field value
> before the initialization is assigned.
For this reason, removing the initialiser is not necessarily harmless; the
code _might_ not work without it. Of course, such code should not be allowed
to exist ...
--
Chris Gray /k/ Embedded Java Solutions
Embedded & Mobile Java, OSGi http://www.kiffer.be/k/
address@hidden +32 3 216 0369