Re: dereference with wildcard [message #69735] |
Tue, 09 February 2010 09:05  |
Carsten Lechte
Messages: 124 Registered: August 2006
|
Senior Member |
|
|
PimK wrote:
> print, mean( (*(*(*pState).navtrack)[*]).lat )
> % Expression must be a scalar in this context: <POINTER Array[2]>.
This is because you can only dereference scalar pointers. This is a fundamental
limitation of IDL's arrays: all array elements have to be of the same scalar
type. You can have arrays of pointers to anything, since the array is made up
of things of the same type (i.e. pointers). If you dereferenced the whole array,
you would have an array of "anything", which is not allowed. IDL refuses to
evaluate the expression, even if all the pointers pointed to a scalar integer,
and the resulting array would be legal in IDL.
chl
|
|
|
Re: dereference with wildcard [message #69815 is a reply to message #69735] |
Wed, 10 February 2010 12:16  |
PimK
Messages: 4 Registered: February 2010
|
Junior Member |
|
|
On Feb 9, 1:05 pm, Carsten Lechte <c...@toppoint.de> wrote:
> PimK wrote:
>> print, mean( (*(*(*pState).navtrack)[*]).lat )
>> % Expression must be a scalar in this context: <POINTER Array[2]>.
>
> This is because you can only dereference scalar pointers. This is a fundamental
> limitation of IDL's arrays: all array elements have to be of the same scalar
> type. You can have arrays of pointers to anything, since the array is made up
> of things of the same type (i.e. pointers). If you dereferenced the whole array,
> you would have an array of "anything", which is not allowed. IDL refuses to
> evaluate the expression, even if all the pointers pointed to a scalar integer,
> and the resulting array would be legal in IDL.
>
> chl
Thanks for the feedback! I'll use loop then instead.
Cheers, P.
|
|
|