RE: [sv-cc] Question on "rand" qualifer on struct elements

From: Bresticker, Shalom <shalom.bresticker_at_.....>
Date: Wed Dec 06 2006 - 04:39:44 PST
Dave,

This is not at all clear.

It is true that the BNF allows declaring any struct member as rand.

However, many restrictions are expressed in the text of the LRM and not
in the BNF.

The text of the LRM certainly seems to imply that rand declarations are
only allowed within classes.

(One could say that typedefs are not really a question, because they
only define types, not actual variables.)

I did not see anywhere in the LRM that the following is permitted:

> typedef struct { rand int A;} A_t;
> 
> A_t Av; // a regular struct;

or that  a rand qualifier outside of a class is just ignored.
Did I miss some text?

Unless there is some explicit text that I missed, I think a
clarification in the LRM is called for.

It would seem strange if I could write outside a class

struct ( rand int b; } cucu ;

but not 

rand int b;


Thanks,
Shalom

 
> -----Original Message-----
> From: owner-sv-cc@server.eda.org [mailto:owner-sv-cc@server.eda.org]
On
> Behalf Of Rich, Dave
> Sent: Wednesday, December 06, 2006 12:09 AM
> To: Bresticker, Shalom; Jim Vellenga; sv-cc@server.eda.org
> Subject: RE: [sv-cc] Question on "rand" qualifer on struct elements
> 
> No that's not correct. The BNF allows you to declare rand or randc on
a
> member of any struct or typedef of a struct. It's just that it's only
> treated as a random variable when declared rand as a member of a
class.
> That is, randomize() is a method of a class, not a method of a struct.
> 
> typedef struct { rand int A;} A_t;
> 
> A_t Av; // a regular struct;
> 
> class C;
> rand A_t m_A;
> endclass
> 
> C C_h = new; // a class with a random variable C_h.m_A.A
> 
> > -----Original Message-----
> > From: owner-sv-cc@server.eda.org [mailto:owner-sv-cc@server.eda.org]
> On
> > Behalf Of Bresticker, Shalom
> > Sent: Tuesday, December 05, 2006 8:52 AM
> > To: Jim Vellenga; sv-cc@server.eda.org
> > Subject: RE: [sv-cc] Question on "rand" qualifer on struct elements
> >
> > Yes. See 13.3.
> >
> > > Clarification:  Does a declaration with rand and randc
> > > qualifiers have to appear only inside a class declaration?
> >
> > Shalom
Received on Wed Dec 6 04:40:01 2006

This archive was generated by hypermail 2.1.8 : Wed Dec 06 2006 - 04:40:22 PST