comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: A simple DLM question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: A simple DLM question [message #81213] Wed, 29 August 2012 11:16
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 8/29/12 11:50 AM, Chris Torrence wrote:
> On Wednesday, August 29, 2012 11:31:39 AM UTC-6, fawltyl...@gmail.com wrote:
>>
>> A '-' can be both unary (-3) and binary (a-3). Including the '-' in the constant would be erroneous in the binary case and you would get a syntax error.
>>
>> There is a similar feature (or bug?) in parsing the exponent of floating point literals. IDL accepts 1e- as a valid float number:
>>
>> IDL> help, 1e-
>> <Expression> FLOAT = 1.00000
>>
>> But this results in a syntax error for expressions like 1e-a:
>>
>> IDL> a=0 & help, 1e-a
>>
>> a=0 & help, 1e-a
>> ^
>> % Syntax error.
>>
>> (I think 1e- should be invalid and 1e-a should be valid.)
>>
>> regards,
>> Lajos
>
> This is the one that always drives me nuts:
> IDL> a = 3
> IDL> help,1d+a
> % Syntax error.
> IDL> help,1d + a
> <Expression> DOUBLE = 4.0000000
>
> What kind of crazy language requires spaces to work properly?!
> [Three cheers for whoever answers this question first! And IDL doesn't count...]
>
> -Chris

Python! (Although you can use tabs as long as you are consistent.)

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Research Mathematician
Tech-X Corporation
Re: A simple DLM question [message #81215 is a reply to message #81213] Wed, 29 August 2012 10:50 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Wednesday, August 29, 2012 11:31:39 AM UTC-6, fawltyl...@gmail.com wrote:
>
> A '-' can be both unary (-3) and binary (a-3). Including the '-' in the constant would be erroneous in the binary case and you would get a syntax error.
>
> There is a similar feature (or bug?) in parsing the exponent of floating point literals. IDL accepts 1e- as a valid float number:
>
> IDL> help, 1e-
> <Expression> FLOAT = 1.00000
>
> But this results in a syntax error for expressions like 1e-a:
>
> IDL> a=0 & help, 1e-a
>
> a=0 & help, 1e-a
> ^
> % Syntax error.
>
> (I think 1e- should be invalid and 1e-a should be valid.)
>
> regards,
> Lajos

This is the one that always drives me nuts:
IDL> a = 3
IDL> help,1d+a
% Syntax error.
IDL> help,1d + a
<Expression> DOUBLE = 4.0000000

What kind of crazy language requires spaces to work properly?!
[Three cheers for whoever answers this question first! And IDL doesn't count...]

-Chris
Re: A simple DLM question [message #81216 is a reply to message #81215] Wed, 29 August 2012 10:31 Go to previous message
Lajos Foldy is currently offline  Lajos Foldy
Messages: 176
Registered: December 2011
Senior Member
On Wednesday, August 29, 2012 6:23:51 PM UTC+2, Xin Tao wrote:

> That's very clear explanation, thanks. But I would still say that it's not very intuitive to me that 3 is a constant but -3 is not.

A '-' can be both unary (-3) and binary (a-3). Including the '-' in the constant would be erroneous in the binary case and you would get a syntax error.


There is a similar feature (or bug?) in parsing the exponent of floating point literals. IDL accepts 1e- as a valid float number:

IDL> help, 1e-
<Expression> FLOAT = 1.00000

But this results in a syntax error for expressions like 1e-a:

IDL> a=0 & help, 1e-a

a=0 & help, 1e-a
^
% Syntax error.

(I think 1e- should be invalid and 1e-a should be valid.)

regards,
Lajos
Re: A simple DLM question [message #81217 is a reply to message #81216] Wed, 29 August 2012 09:23 Go to previous message
Xin Tao is currently offline  Xin Tao
Messages: 40
Registered: April 2011
Member
That's very clear explanation, thanks. But I would still say that it's not very intuitive to me that 3 is a constant but -3 is not.

On Wednesday, August 29, 2012 10:55:28 AM UTC-5, Chris Torrence wrote:
> Hi all,
>
>
>
> Just to clarify, this isn't a bug. It just happens that since the minus sign is an operator, then a number such as -1 gets turned into an expression, which is stored in a temporary variable. It is treated the same way as say "-a" where "a" is a variable.
>
>
>
> Jimmy said "The macro (in idl_export.h, if you're interested) doesn't do extensive checking, and you should only free variables that are temps, not expressions or constants."
>
>
>
> That isn't quite correct. In this particular case, you *must* check (v != argv[0]), regardless of whether it is a constant or temp variable. That is because if the type conversion was not needed, then "v" will be equal to argv[0]. In this case, your code does not "own" argv[0] since it didn't allocate it. Freeing "v" is bad in that case, because IDL will attempt to free it later, and a double free will occur.
>
>
>
> Probably the best way to write the line of code is:
>
>
>
> if (v != argv[0]) IDL_Deltmp(v);
>
>
>
> Here, you don't need to use the macro, because you *know* that if "v" is not equal, then it must be a temporary that is owned by you, and you can free it without doing any further checks.
>
>
>
> Hope this helps.
>
>
>
> -Chris
>
> ExelisVIS
Re: A simple DLM question [message #81218 is a reply to message #81217] Wed, 29 August 2012 08:55 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
Hi all,

Just to clarify, this isn't a bug. It just happens that since the minus sign is an operator, then a number such as -1 gets turned into an expression, which is stored in a temporary variable. It is treated the same way as say "-a" where "a" is a variable.

Jimmy said "The macro (in idl_export.h, if you're interested) doesn't do extensive checking, and you should only free variables that are temps, not expressions or constants."

That isn't quite correct. In this particular case, you *must* check (v != argv[0]), regardless of whether it is a constant or temp variable. That is because if the type conversion was not needed, then "v" will be equal to argv[0]. In this case, your code does not "own" argv[0] since it didn't allocate it. Freeing "v" is bad in that case, because IDL will attempt to free it later, and a double free will occur.

Probably the best way to write the line of code is:

if (v != argv[0]) IDL_Deltmp(v);

Here, you don't need to use the macro, because you *know* that if "v" is not equal, then it must be a temporary that is owned by you, and you can free it without doing any further checks.

Hope this helps.

-Chris
ExelisVIS
Re: A simple DLM question [message #81223 is a reply to message #81218] Tue, 28 August 2012 22:03 Go to previous message
Xin Tao is currently offline  Xin Tao
Messages: 40
Registered: April 2011
Member
Maybe it's a bug! Anyway, Jimmy's trick did it, but I'm still confused by IDL's EDG.

On Tuesday, August 28, 2012 8:10:17 PM UTC-5, Craig Markwardt wrote:
> On Tuesday, August 28, 2012 5:16:53 PM UTC-4, Xin Tao wrote:
>
>> I did check the flags of IDL_V_CONST and IDL_V_TEMP. Both failed, and then I posted the question. For example, I'm not sure how to explain this results.
>
>>
>
>>
>
>>
>
>> // Code here.
>
>>
>
>>
>
>>
>
>> void simple(int argc, IDL_VPTR argv[])
>
>>
>
>> {
>
>>
>
>> IDL_VPTR v;
>
>>
>
>>
>
>>
>
>> v = IDL_BasicTypeConversion(1, &argv[0], IDL_TYP_DOUBLE);
>
>>
>
>>
>
>>
>
>> printf("const = %d\n", v->flags & IDL_V_CONST);
>
>>
>
>> printf("temp = %d\n", v->flags & IDL_V_TEMP);
>
>>
>
>>
>
>>
>
>> if (v != argv[0]) IDL_DELTMP(v);
>
>>
>
>> }
>
>>
>
>>
>
>>
>
>>
>
>>
>
>> Now results:
>
>>
>
>>
>
>>
>
>> IDL> simple, 3.0d
>
>>
>
>> const = 1
>
>>
>
>> temp = 0
>
>>
>
>> IDL> simple, -3.0d
>
>>
>
>> const = 0
>
>>
>
>> temp = 2
>
>
>
> It is a little odd, but it may be the difference between 3.0d, a constant, and -(3.0d), which is an expression. But I'd think that IDL should be smart enough to parse -3.0d as a constant.
>
>
>
> Craig
Re: A simple DLM question [message #81224 is a reply to message #81223] Tue, 28 August 2012 18:10 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Tuesday, August 28, 2012 5:16:53 PM UTC-4, Xin Tao wrote:
> I did check the flags of IDL_V_CONST and IDL_V_TEMP. Both failed, and then I posted the question. For example, I'm not sure how to explain this results.
>
>
>
> // Code here.
>
>
>
> void simple(int argc, IDL_VPTR argv[])
>
> {
>
> IDL_VPTR v;
>
>
>
> v = IDL_BasicTypeConversion(1, &argv[0], IDL_TYP_DOUBLE);
>
>
>
> printf("const = %d\n", v->flags & IDL_V_CONST);
>
> printf("temp = %d\n", v->flags & IDL_V_TEMP);
>
>
>
> if (v != argv[0]) IDL_DELTMP(v);
>
> }
>
>
>
>
>
> Now results:
>
>
>
> IDL> simple, 3.0d
>
> const = 1
>
> temp = 0
>
> IDL> simple, -3.0d
>
> const = 0
>
> temp = 2

It is a little odd, but it may be the difference between 3.0d, a constant, and -(3.0d), which is an expression. But I'd think that IDL should be smart enough to parse -3.0d as a constant.

Craig
Re: A simple DLM question [message #81227 is a reply to message #81224] Tue, 28 August 2012 14:16 Go to previous message
Xin Tao is currently offline  Xin Tao
Messages: 40
Registered: April 2011
Member
I did check the flags of IDL_V_CONST and IDL_V_TEMP. Both failed, and then I posted the question. For example, I'm not sure how to explain this results.

// Code here.

void simple(int argc, IDL_VPTR argv[])
{
IDL_VPTR v;

v = IDL_BasicTypeConversion(1, &argv[0], IDL_TYP_DOUBLE);

printf("const = %d\n", v->flags & IDL_V_CONST);
printf("temp = %d\n", v->flags & IDL_V_TEMP);

if (v != argv[0]) IDL_DELTMP(v);
}


Now results:

IDL> simple, 3.0d
const = 1
temp = 0
IDL> simple, -3.0d
const = 0
temp = 2

This sounds really strange to me. But if there is a good explanation of this, please let me know. Thanks.

Xin Tao



On Tuesday, August 28, 2012 11:06:44 AM UTC-5, jimmylee...@gmail.com wrote:
> On Monday, August 27, 2012 4:04:43 PM UTC-6, Xin Tao wrote:
>
>> Thanks Jimmy. That indeed solved my problem. It was so confusing to me, because I found from the External Development Guide that IDL_DELTMP should check it first. :)
>
>>
>
>>
>
>>
>
>> On Monday, August 27, 2012 3:48:27 PM UTC-5, jimmylee...@gmail.com wrote:
>
>>
>
>>> On Monday, August 27, 2012 11:13:57 AM UTC-6, Xin Tao wrote:
>
>>
>
>>>
>
>>
>
>>>> Hi,
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> I'm having trouble figuring out the problem of the following DLM code:
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> /* The c routine */
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> void simple(int argc, IDL_VPTR argv[])
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> {
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> IDL_VPTR v;
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> v = IDL_BasicTypeConversion(1, &argv[0], IDL_TYP_DOUBLE);
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> IDL_DELTMP(v);
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> }
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> This routine just takes its input and convert it to double. After converting it to a DLM, however, I seem to see strange results.
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> IDL> simple, 1.0d
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> % Loaded DLM: TESTMODULE.
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> IDL> simple, -1.0d
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> Bus error
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> That is: if I give it 1.0d as input, then the code is fine. However, if I use -1.0d, then there is a BUS error, presumably from IDL_DELTMP(v). I really don't understand why this is the case. Isn't IDL_DELTMP supposed to decide first whether v is a temporary variable or not? If I remove IDL_DELTMP, of course, I'll frequently get the annoying warning message "% Temporary variables are still checked out - cleaning up...".
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> Please give me some help. Thanks.
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Try this:
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> if (v != argv[0]) IDL_DELTMP(v);
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> That is, no conversion was necessary.
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> The macro (in idl_export.h, if you're interested) doesn't do extensive checking, and you should only free variables that are temps, not expressions or constants.
>
>
>
> The docs are correct, but are confusing if you're not aware of the difference between IDL's temporary variables, constants, and named variables. It's not stated explicitly in this section that a constant like 1.0D is a different sort of data type internally than an expression or named variable, though that topic is discussed earlier in the docs.
>
>
>
> IDL_DELTMP doesn't check if the IDL_VARIABLE has the contant flag set (IDL_V_CONST), only the temporary flag (IDL_V_TEMP).
>
>
>
> As a matter of habit, I always check the equality of the argv[] used as input against the output from any type conversion routine call before calling IDL_DELTMP. You can't predict when a user has entered an explicit constant value, rather than a variable name or expression.
Re: A simple DLM question [message #81237 is a reply to message #81227] Tue, 28 August 2012 09:06 Go to previous message
Jim  Pendleton is currently offline  Jim Pendleton
Messages: 165
Registered: November 2011
Senior Member
On Monday, August 27, 2012 4:04:43 PM UTC-6, Xin Tao wrote:
> Thanks Jimmy. That indeed solved my problem. It was so confusing to me, because I found from the External Development Guide that IDL_DELTMP should check it first. :)
>
>
>
> On Monday, August 27, 2012 3:48:27 PM UTC-5, jimmylee...@gmail.com wrote:
>
>> On Monday, August 27, 2012 11:13:57 AM UTC-6, Xin Tao wrote:
>
>>
>
>>> Hi,
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> I'm having trouble figuring out the problem of the following DLM code:
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> /* The c routine */
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> void simple(int argc, IDL_VPTR argv[])
>
>>
>
>>>
>
>>
>
>>> {
>
>>
>
>>>
>
>>
>
>>> IDL_VPTR v;
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> v = IDL_BasicTypeConversion(1, &argv[0], IDL_TYP_DOUBLE);
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> IDL_DELTMP(v);
>
>>
>
>>>
>
>>
>
>>> }
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> This routine just takes its input and convert it to double. After converting it to a DLM, however, I seem to see strange results.
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> IDL> simple, 1.0d
>
>>
>
>>>
>
>>
>
>>> % Loaded DLM: TESTMODULE.
>
>>
>
>>>
>
>>
>
>>> IDL> simple, -1.0d
>
>>
>
>>>
>
>>
>
>>> Bus error
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> That is: if I give it 1.0d as input, then the code is fine. However, if I use -1.0d, then there is a BUS error, presumably from IDL_DELTMP(v). I really don't understand why this is the case. Isn't IDL_DELTMP supposed to decide first whether v is a temporary variable or not? If I remove IDL_DELTMP, of course, I'll frequently get the annoying warning message "% Temporary variables are still checked out - cleaning up...".
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Please give me some help. Thanks.
>
>>
>
>>
>
>>
>
>> Try this:
>
>>
>
>>
>
>>
>
>> if (v != argv[0]) IDL_DELTMP(v);
>
>>
>
>>
>
>>
>
>> That is, no conversion was necessary.
>
>>
>
>>
>
>>
>
>> The macro (in idl_export.h, if you're interested) doesn't do extensive checking, and you should only free variables that are temps, not expressions or constants.

The docs are correct, but are confusing if you're not aware of the difference between IDL's temporary variables, constants, and named variables. It's not stated explicitly in this section that a constant like 1.0D is a different sort of data type internally than an expression or named variable, though that topic is discussed earlier in the docs.

IDL_DELTMP doesn't check if the IDL_VARIABLE has the contant flag set (IDL_V_CONST), only the temporary flag (IDL_V_TEMP).

As a matter of habit, I always check the equality of the argv[] used as input against the output from any type conversion routine call before calling IDL_DELTMP. You can't predict when a user has entered an explicit constant value, rather than a variable name or expression.
Re: A simple DLM question [message #81244 is a reply to message #81237] Mon, 27 August 2012 15:08 Go to previous message
Xin Tao is currently offline  Xin Tao
Messages: 40
Registered: April 2011
Member
On Monday, August 27, 2012 3:51:10 PM UTC-5, Craig Markwardt wrote:
> On Monday, August 27, 2012 1:13:57 PM UTC-4, Xin Tao wrote:
>
> ...
>
>> Please give me some help. Thanks.
>
>
>
> Your first problem is putting "Simple" and "DLM question" in the same sentence. :-)

I've been learning DLM for a whole day, and I thought that would be a *simple* question for some experts. :)
Re: A simple DLM question [message #81245 is a reply to message #81244] Mon, 27 August 2012 15:04 Go to previous message
Xin Tao is currently offline  Xin Tao
Messages: 40
Registered: April 2011
Member
Thanks Jimmy. That indeed solved my problem. It was so confusing to me, because I found from the External Development Guide that IDL_DELTMP should check it first. :)

On Monday, August 27, 2012 3:48:27 PM UTC-5, jimmylee...@gmail.com wrote:
> On Monday, August 27, 2012 11:13:57 AM UTC-6, Xin Tao wrote:
>
>> Hi,
>
>>
>
>>
>
>>
>
>> I'm having trouble figuring out the problem of the following DLM code:
>
>>
>
>>
>
>>
>
>> /* The c routine */
>
>>
>
>>
>
>>
>
>> void simple(int argc, IDL_VPTR argv[])
>
>>
>
>> {
>
>>
>
>> IDL_VPTR v;
>
>>
>
>>
>
>>
>
>> v = IDL_BasicTypeConversion(1, &argv[0], IDL_TYP_DOUBLE);
>
>>
>
>>
>
>>
>
>> IDL_DELTMP(v);
>
>>
>
>> }
>
>>
>
>>
>
>>
>
>> This routine just takes its input and convert it to double. After converting it to a DLM, however, I seem to see strange results.
>
>>
>
>>
>
>>
>
>> IDL> simple, 1.0d
>
>>
>
>> % Loaded DLM: TESTMODULE.
>
>>
>
>> IDL> simple, -1.0d
>
>>
>
>> Bus error
>
>>
>
>>
>
>>
>
>> That is: if I give it 1.0d as input, then the code is fine. However, if I use -1.0d, then there is a BUS error, presumably from IDL_DELTMP(v). I really don't understand why this is the case. Isn't IDL_DELTMP supposed to decide first whether v is a temporary variable or not? If I remove IDL_DELTMP, of course, I'll frequently get the annoying warning message "% Temporary variables are still checked out - cleaning up...".
>
>>
>
>>
>
>>
>
>> Please give me some help. Thanks.
>
>
>
> Try this:
>
>
>
> if (v != argv[0]) IDL_DELTMP(v);
>
>
>
> That is, no conversion was necessary.
>
>
>
> The macro (in idl_export.h, if you're interested) doesn't do extensive checking, and you should only free variables that are temps, not expressions or constants.
Re: A simple DLM question [message #81246 is a reply to message #81245] Mon, 27 August 2012 13:51 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Monday, August 27, 2012 1:13:57 PM UTC-4, Xin Tao wrote:
...
> Please give me some help. Thanks.

Your first problem is putting "Simple" and "DLM question" in the same sentence. :-)
Re: A simple DLM question [message #81247 is a reply to message #81246] Mon, 27 August 2012 13:48 Go to previous message
Jim  Pendleton is currently offline  Jim Pendleton
Messages: 165
Registered: November 2011
Senior Member
On Monday, August 27, 2012 11:13:57 AM UTC-6, Xin Tao wrote:
> Hi,
>
>
>
> I'm having trouble figuring out the problem of the following DLM code:
>
>
>
> /* The c routine */
>
>
>
> void simple(int argc, IDL_VPTR argv[])
>
> {
>
> IDL_VPTR v;
>
>
>
> v = IDL_BasicTypeConversion(1, &argv[0], IDL_TYP_DOUBLE);
>
>
>
> IDL_DELTMP(v);
>
> }
>
>
>
> This routine just takes its input and convert it to double. After converting it to a DLM, however, I seem to see strange results.
>
>
>
> IDL> simple, 1.0d
>
> % Loaded DLM: TESTMODULE.
>
> IDL> simple, -1.0d
>
> Bus error
>
>
>
> That is: if I give it 1.0d as input, then the code is fine. However, if I use -1.0d, then there is a BUS error, presumably from IDL_DELTMP(v). I really don't understand why this is the case. Isn't IDL_DELTMP supposed to decide first whether v is a temporary variable or not? If I remove IDL_DELTMP, of course, I'll frequently get the annoying warning message "% Temporary variables are still checked out - cleaning up...".
>
>
>
> Please give me some help. Thanks.

Try this:

if (v != argv[0]) IDL_DELTMP(v);

That is, no conversion was necessary.

The macro (in idl_export.h, if you're interested) doesn't do extensive checking, and you should only free variables that are temps, not expressions or constants.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Tasselated Cap in IDL?
Next Topic: Re: Succinct way of testing array membership

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:55:48 PDT 2025

Total time taken to generate the page: 0.00497 seconds