Mark, I believe that only classes that are specialized must be created and initialized. That includes classes that use the default specialization. As you point out, a class that has no default parameter may not even be realizable, or equally problematic, the default parameter may trigger some other problem. Short answer to the question, the example should print: Init value = 2 Arturo From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of Mark Hartoog Sent: Thursday, October 30, 2008 11:42 AM To: sv-ec@eda.org Subject: [sv-ec] Class static memember initialization The LRM does say "A generic class is not a type; only a concrete specialization represents a type," but it is very unclear what the rules are about initialization of static members . Consider this simple example: module test; class C #(p = 1); static function int f(); $display("Init value = ", p); return p; endfunction static int value = f(); endclass C #(2) c = new(); endmodule Should this print: Init value = 1 Init value = 2 Or should it just print: Init value = 2 Do the static members of class 'C' get initialized for the default parameter values of the class, even though the default parameter values are never used in the design? If you think the static members should always be initialized for default values, even though they are not used, then what about the case where the parameter has no default value? class C #(p); static function int f(); $display("Init value = ", p); return p; endfunction static int value = f(); endclass C #(2) c = new(); endmodule What about the case where the parameterized class is never used in the design at all? What about a non-parameterized class that is never used in the design? If parameterized classes are like C++ templates, then the static members should only be initialized for classes that are used in the design, but the LRM does not seem clear about this. -- This message has been scanned for viruses and dangerous content by MailScanner <http://www.mailscanner.info/> , and is believed to be clean. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Thu Oct 30 15:33:13 2008
This archive was generated by hypermail 2.1.8 : Thu Oct 30 2008 - 15:33:51 PDT