RE: [sv-ec] Initialisation of static data members

From: Rich, Dave <Dave_Rich_at_.....>
Date: Tue Aug 08 2006 - 13:56:54 PDT
Then the LRM contradicts itself because the next sentence says:
"Hierarchical names are allowed because constants declared with the
const keyword are calculated after elaboration."

Hierarchical names are not part of constant expressions.

I think your example should be legal, although the LRM does not mention
any order dependencies. For random object stability, we already state
that seeds are taken in the order they appear in the source, so I don't
see why we don't initialize variables in the order they appear within a
given scope. There should be no guarantees with hierarchical references.

In any case, calling a static method as part of a static initialization
of a class property should be legal.

Dave



> -----Original Message-----
> From: owner-sv-ec@server.eda-stds.org [mailto:owner-sv-ec@server.eda-
> stds.org] On Behalf Of Brad Pierce
> Sent: Tuesday, August 08, 2006 8:47 AM
> To: sv-ec@server.eda-stds.org
> Subject: Re: [sv-ec] Initialisation of static data members
> 
> According to 6.3.5 --
> 
> "A static constant declared with the const keyword can be set to an
> expression of literals, parameters, local parameters, genvars,
> enumerated names, a constant function of these, or other constants.
> [...] An automatic constant declared with the const keyword can be set
> to any expression that would be legal without the const keyword."
> 
> >There are no special restrictions on the initializers of static data
> declarations
> >or even const declarations.
> 
> Wouldn't the following be illegal for a static constant c?
> 
>     int v = 0;
>     const int c = v;
> 
> -- Brad
Received on Tue Aug 8 13:56:58 2006

This archive was generated by hypermail 2.1.8 : Tue Aug 08 2006 - 13:57:10 PDT