Re: Pointer syntax and IDL 4.0: summary [message #28577 is a reply to message #28573] |
Thu, 20 December 2001 13:00  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
tam <tam@lheapop.gsfc.nasa.gov> writes:
> tam wrote:
>
>>
> ...
>
>
>> Is there any way of addressing this, i.e., dereferencing a pointer
>> in a way that will not cause a syntax error for earlier versions of IDL?
>> Thanks,
>> Tom McGlynn
>> tam@lheapop.gsfc.nasa.gov
>>
> Thanks to all who wrote responses. I'm not sure any do quite what I want
> but I now have a set of options...
>
> 1. I can just forget about backwards compatibilility with the old
> code -- figure v4 users can use earlier versions of my code.
>
> 2. Use library routines, like Liam Gumley's, which hide the derefenence
> in a single function call and hope that V4 users don't explicitly try to
> compile that function. In Liam's code the Pointer_setgetv5 routine
> has the dereference syntax. It means that the user has to download
> at least two separate files.
You misinterpret Liam's library. The POINTER_SETGETV5 procedure is
*only* called when the user has IDL 5. Thus, in the normal course of
events, and IDL 4 user can download the file but it will never be
compiled or used. In the abnormal course of events, the user tries to
compile the file and it fails, but that doesn't stop the program from
working, since it will never be invoked.
I am renowned for keeping IDL 4 compatibility in my code. I still
haven't changed to the [] syntax for array indexing (not broke, don't
fix it). If you *do* use the [] notation, then forget IDL 4, stick
with IDL 5 only.
Even so, the convenience of IDL 5 pointers is such that I am using
them now in my new programs.
> 4. Use run-time compilation (a la 3) but compile a function (as in 2) to do
> the dereference. This would be nice since it would combine
> efficiency and common v4/v5 code. Alas I can't get execute to compile
> a function, so this requires creating
> a temporary file -- and that's a real pain. Does anyone know how/if you
> can compile a function in execute (or more generally without
> reference to a physical file)? I'm hoping there's some devious
> route around the limits that IDL seems to have here.
There is no way to do this, other than dynamic compilation of a
temporary file. Pavel has a secret about this :-)
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|