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 
Return to the default flat view Create a new topic Submit Reply
Re: A simple DLM question [message #81245 is a reply to message #81244] Mon, 27 August 2012 15:04 Go to previous messageGo 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.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
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: Fri Oct 10 19:22:12 PDT 2025

Total time taken to generate the page: 1.27796 seconds