[sv-ec] class global const fields

From: danielm <danielm_at_.....>
Date: Tue Nov 06 2007 - 02:55:53 PST
LRM 1800-2005 in ch 7.18 states:
"Typically, global constants are also declared static because they are the
same for all instances of the class.However, an instance constant cannot be
declared static because that would disallow all assignments in the
constructor."

I dont understand what word typically means for global constans. Are there
any exepctions? IMHO global const should be by default static ( the static
keyword is optional - global const will be static any way so ie both c1 and
c2 can be accessed by C::c1 , C::c2 )

 ie in below code both constans are static:

class C;

    const int c1 = 1;
    static const int c2 = 1;

endclass


On the other han using static for instance const should trigger error.

If i'm right then I think that wording in this chapter should be changed.

 

Regards,

DANiel


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Nov 6 02:55:58 2007

This archive was generated by hypermail 2.1.8 : Tue Nov 06 2007 - 02:56:10 PST