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, and is believed to be clean.Received on Thu Oct 30 11:45:03 2008
This archive was generated by hypermail 2.1.8 : Thu Oct 30 2008 - 11:45:50 PDT