Daniel,
I believe it should display the hello msg but I cannot find text in the LRM saying this.
The only relevant text I found is in section 8.8
In section 8.8, there is an example f a static property opening a file. After the example it says that the property fileId should
be created an initialized. This class is a parameterless class, so it only has one specialization.
It is unclear what happen to default class specializations of parameterized classes.
Francoise
'
________________________________
From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of Daniel Mlynek
Sent: Wednesday, February 17, 2010 9:35 AM
To: sv-ec@eda.org
Subject: [sv-ec] static members initialization in class nested in package
In below code there is class A nested in package. Class A is never used, but it has static member which is initialized with function call. This function has side efect - it this example it displays a string on console.
How it should work? I cannot figure it out form LRM. Is it somewhere explicitly said in LRM?
CODE:
package p;
class A;
static function int f;
$display("hello p"); //should it be displayed?
return 0;
endfunction
static int i = f();
endclass
endpackage
module top;
import p::*;
initial
$display("hello");
endmodule
Similar problem for version with no packages:
class A;
static function int f;
$display("hello p"); //should it be displayed?
return 0;
endfunction
static int i = f();
endclass
module top;
initial
$display("hello");
endmodule
DANiel
-- 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 Wed Feb 17 10:36:35 2010
This archive was generated by hypermail 2.1.8 : Wed Feb 17 2010 - 10:36:41 PST