Dave, That statement was there mainly to avoid ordering and race problems associated with declaration initializations, which, as you point out exist with other declarations. However, the severity of an ordering problem with static class declarations is worse than for other (static) declarations because accessing un-initialized objects have no defined behavior and will likely cause a crash. Because these declarations execute outside the procedural context, such problems are very hard to debug. A secondary goal was to attempt to keep implementations from deviating. Otherwise, the LRM would have to mandate an explicit ordering; something that was too ambitious at the time. Interestingly, the expression used by your example is not constant, but will behaves like a constant because its value is set even before variable declarations. Arturo ________________________________ From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of Rich, Dave Sent: Wednesday, November 15, 2006 8:29 AM To: sv-ec@eda-stds.org Subject: [sv-ec] constant expression in call to new Section 6.3.5 about const constants says "The arguments to the new method must be constant expressions." Can anybody think of a reason why we need this rule? Why single out new from any other function call? Any variable declaration initialization, const or non-const will have problems if you reference other variables. The reason I ask is I would like to be able to do things like const classname foo= new($test$plusargs("switch")); DaveReceived on Wed Nov 15 10:28:42 2006
This archive was generated by hypermail 2.1.8 : Wed Nov 15 2006 - 10:28:55 PST