Another pointer question

T

Tricky

Guest
If I point to some basic type, how can I set the value at the pointer?

eg:

type I_ptr is access integer;
..
..
..
variable A : I_ptr
...
A := new integer;

A := 10; --does not work - complains that A is not an integer (rightly
so);

same with any new types that are discrete

type A_t;
type A_ptr is access A_t;

type A_t is (X, Y, Z);
...
variable S : A_ptr;
...
S := new A_t;

S := X; --same problem as with integer;

Am I, as usually, trying to go outside the scope of VHDL?
 
On Wed, 6 Aug 2008 02:22:29 -0700 (PDT), Tricky <Trickyhead@gmail.com>
wrote:

If I point to some basic type, how can I set the value at the pointer?

eg:

type I_ptr is access integer;

variable A : I_ptr
..
A := new integer;

A := 10; --does not work - complains that A is not an integer (rightly
so);
Dereferencing the pointer when you need the contents is normally
implicit; but in this case would cause ambiguity (to make it obvious,
consider a pointer to a pointer to an integer!).

However you can dereference it explicitly to avoid the problem

A.all := 10;

S := new A_t;
S := X; --same problem as with integer;
S.all := x;

- Brian
 

Welcome to EDABoard.com

Sponsor

Back
Top