{Disarmed} Re: [sv-ec] protected/local, virtual, static, extern question

From: Don Mills <mills_at_.....>
Date: Mon Sep 24 2007 - 15:30:16 PDT
To elaborate further on Dave's final statement about "static", are the following two statements correct?

function static void foo();

only means that *variables* declared inside foo are static by default (and arguments may not be ref).  The function itself is not static. That is, memory is allocated for the function for each instantiation of the class, and the method may operate on automatic values.

static function void foo();

means that the function itself is static. Memory for the function is allocated once, regardless of how many times the class is instantiated, and the method may not operate on automatic values.

Does this sound reasonable?



Rich, Dave wrote:

Don,

 

The BNF item { method_qualifier } means repetition 0 or more times, and no order is implied. (but footnote limits it to a range of 0-1 times) The BNF does not allow extern to anywhere but where it shows in the production, at the beginning.

 

The use of the keyword static as a class_item_qualifier is independent of the use of static as part of a task or function declaration, so its use before or after the keyword function has different semantics.

 

Dave

 

 


From: owner-sv-ec@server.eda.org [mailto:owner-sv-ec@server.eda.org] On Behalf Of Don Mills
Sent: Thursday, September 20, 2007 4:40 PM
To: sv-ec@server.eda.org
Subject: [sv-ec] protected/local, virtual, static, extern quesiton

 


Does the ordering of protected/local and virtual matter?

That is,
virtual protected function void blah();
vs.
protected virtual function void blah();

It appears that at least one vendor doesn't seem to care.

As for the other keywords, I believe that extern has to go before everything.
Are there any ordering requirements on static?

>From the LRM:
class_method ::=
{ method_qualifier } task_declaration
| { method_qualifier } function_declaration
| extern { method_qualifier } method_prototype ;
| { method_qualifier } class_constructor_declaration
| extern { method_qualifier } class_constructor_prototype

method_qualifier7 ::=
virtual
| class_item_qualifier

class_item_qualifier7 ::=
static
| protected
| local



footnote #7) In any one declaration, only one of protected or local is allowed, only one of rand or randc is
allowed, and static and/or virtual can appear only once.



-- 
==========================================================
Don Mills
mills@lcdm-eng.com
www.lcdm-eng.com
==========================================================

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean. _popupControl();

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean. Received on Mon Sep 24 15:31:35 2007

This archive was generated by hypermail 2.1.8 : Mon Sep 24 2007 - 15:32:06 PDT