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 #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.
[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: Sat Oct 11 21:38:36 PDT 2025

Total time taken to generate the page: 2.23962 seconds