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

Home » Public Forums » archive » Bug in N_PARAMS?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Bug in N_PARAMS? [message #64011] Mon, 24 November 2008 11:31 Go to previous message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
I have been having some very odd problems with the N_PARAMS function lately.

Here is a simple example with a main program and a function.


PRO N_PARAMS_MAIN, a, b
COMPILE_OPT IDL2
PRINT, 'N_PARAMS_MAIN - Number of parameters : ', N_PARAMS()
HELP, a, b
value = N_PARAMS_BUG(a, b)
END


FUNCTION N_PARAMS_BUG, a, b
COMPILE_OPT IDL2
PRINT, 'N_PARAMS_BUG - Number of parameters : ', N_PARAMS()
HELP, a, b
RETURN, 0
END


Here is the output from a new IDL session:

stretch> idl
IDL Version 6.4.1, Mac OS X (darwin i386 m32). (c) 2007, ITT Visual Information Solutions

IDL> N_PARAMS_MAIN, 13
% Compiled module: N_PARAMS_MAIN.
N_PARAMS_MAIN - Number of parameters : 1
A LONG = 13
B UNDEFINED = <Undefined>
% Compiled module: N_PARAMS_BUG.
N_PARAMS_BUG - Number of parameters : 2 <-- returns 2, but b is undefined
A LONG = 13
B UNDEFINED = <Undefined>

In the main program N_PARAMS_MAIN, N_PARAMS correctly returns the number of defined arguments (one).

In the function N_PARAMS_BUG, the argument count is incorrectly given as two.


If I call the function N_PARAMS_BUG from the command line, it works correctly.

IDL> PRINT, N_PARAMS_BUG(10)
N_PARAMS_BUG - Number of parameters : 1
A LONG = 10
B UNDEFINED = <Undefined>
0


Am I missing something obvious here?

Ken
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Bug in N_PARAMS?
Next Topic: Re: streamlines over contour without iVector

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

Current Time: Wed Oct 08 17:04:30 PDT 2025

Total time taken to generate the page: 0.00471 seconds