Re: no backwards compatibility in IDL 5.6 [message #34311 is a reply to message #34224] |
Fri, 28 February 2003 12:12   |
thompson
Messages: 584 Registered: August 1991
|
Senior Member |
|
|
Pavel Romashkin <pavel_romashkin@hotmail.com> writes:
> Why is EXECUTE used in this program? Why can't the value just be
> returned from each CASE? Execute will slow it down and as far as I can
> tell, does nothing special. There is no code that follows the CASE to
> prevent you from returning at any point. Will it not compile in 5.4 with
> the extra keyword? I thought keyword mismatches are runtime errors. Am I
> missing something?
> Pavel
Yes, without the execute statement, it will not compile in versions earlier
than 5.4. You get the error message
IDL> .run atan_complex_wrapper
(version GE 5.6): returnValue = ATAN(complexNum, /Phase)
^
% Keyword parameters not allowed in call.
At: /disk1/thompson/atan_complex_wrapper.pro, Line 12
% 1 Compilation errors in module ATAN_COMPLEX_WRAPPER.
However, only the last execute statement is actually required. The first two,
without the new keyword, can be direct statements.
Bill Thompson
> David Fanning wrote:
>>
>> FUNCTION ATAN_COMPLEX_WRAPPER, complexNum
>>
>> returnValue = 0.0
>> version = Float(!VERSION.Release)
>> CASE 1 OF
>> (version LE 5.4): ok = Execute('returnValue = ATAN(complexNum)')
>> (version EQ 5.5): BEGIN
>> realpart = Real_Part(complexNum)
>> imgpart = Imaginary(complexNum)
>> ok = Execute('returnValue = ATAN(realpart, imgpart)')
>> END
>> (version GE 5.6): ok = Execute('returnValue = ' + $
>> 'ATAN(complexNum, /Phase)')
>> ENDCASE
>> RETURN, returnValue
>> END
|
|
|