| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| 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? |
|
#2
| |||
| |||
| 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 |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.