[sv-ec] static members initialization in class nested in package

From: Daniel Mlynek <daniel.mlynek@aldec.com.pl>
Date: Wed Feb 17 2010 - 06:34:54 PST

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, and is
believed to be clean.
Received on Wed Feb 17 06:35:25 2010

This archive was generated by hypermail 2.1.8 : Wed Feb 17 2010 - 06:35:40 PST