|
From: | Per Bothner |
Subject: | Re: redundant field initializers |
Date: | Mon, 20 Sep 2004 13:42:45 -0700 |
User-agent: | Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.2) Gecko/20040803 |
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 exmple: class Z { static int peek() { return j++; } static int i = peek(); static int j = 0; } -- --Per Bothner address@hidden http://per.bothner.com/
[Prev in Thread] | Current Thread | [Next in Thread] |