RE: [sv-bc] RE: [sv-ec] New proposal for Mantis 0001556: in-line static variable initialization - require keyword static?

From: Brad Pierce <Brad.Pierce_at_.....>
Date: Sun Sep 16 2007 - 09:56:35 PDT
Instead of explicitly using the 'static' keyword, I should have instead
simply shown the subroutine declaration in the context of a module
declaration.  Unlike in a class, the default lifetime of a subroutine in
a module is static.  For example, after the change, the following will
become illegal.
 
module m(...);
 
function longint f(byte n);

      longint subtotal = 0;  // Illegal

      return (subtotal += n);

   endfunction

...
endmodule m

________________________________

From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of
Bresticker, Shalom
Sent: Sunday, September 16, 2007 12:53 AM
To: Rich, Dave; sv-ec@eda-stds.org
Cc: sv-bc@eda-stds.org
Subject: RE: [sv-bc] RE: [sv-ec] New proposal for Mantis 0001556:
in-line static variable initialization - require keyword static?


One common methodology is to have a task or function maintain a counter
of how many times it has been called.
 
Shalom



	[DR] I don't know why any would want to do this. If this were in
a class, they probably meant 'static function logint f(byte n);' so they
are likely to get an error when they try to statically access the method
anyways.

	   function static longint f(byte n);

	      longint subtotal = 0;  // Illegal

	      return (subtotal += n);

	   endfunction

	

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

-- 
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 Sun Sep 16 09:58:27 2007

This archive was generated by hypermail 2.1.8 : Sun Sep 16 2007 - 09:59:58 PDT