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

From: Rich, Dave <Dave_Rich_at_.....>
Date: Tue Aug 08 2006 - 14:10:43 PDT
It says "or other constants" 

In any case, a hierarchical name is not "an expression of literals,
parameters, local parameters, genvars, enumerated names, a constant
function of these, or other constants", so there is the contradictions.

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 2:02 PM
> To: sv-ec@server.eda-stds.org
> Subject: RE: [sv-ec] Initialisation of static data members
> 
> The paragraph I quoted didn't use the phrase "constant expression".
> Where's the contradiction?
> 
> -- Brad
> 
> -----Original Message-----
> From: Rich, Dave [mailto:Dave_Rich@mentor.com]
> Sent: Tuesday, August 08, 2006 1:57 PM
> To: Brad Pierce; sv-ec@eda-stds.org
> Subject: RE: [sv-ec] Initialisation of static data members
> 
> 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 14:10:47 2006

This archive was generated by hypermail 2.1.8 : Tue Aug 08 2006 - 14:10:52 PDT