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

Home » Public Forums » archive » Passing Keyword Parameters
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
Passing Keyword Parameters [message #15581] Mon, 31 May 1999 00:00
konu is currently offline  konu
Messages: 2
Registered: May 1999
Junior Member
I want to write a procedure with the following prototype:

PRO easy_hist, file, hist_min = hist_min_val, hist_max = hist_max_val

Because I want hist_min_val and hist_max_val to be optional keyword
parameters, I use the following in easy_hist:

if (keyword_set(hist_min_val) eq 0) then hist_min_val = 1
if (keyword_set(hist_max_val) eq 0) then hist_max_val = 255

The procedure has a bug in the sense that, if it is called with
hist_min_val = 0, keyword_set(hist_min_val) returns zero and so
hist_min_val is set to its default value of 1. Clearly the user
intended to set hist_min_val equal to 0.

Is there a simple way fix this bug in my procedure?

Thanks,

Kristjan Onu

PS. I am using IDL Version 5.0.3 (sunos sparc).
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL and 3D scattered data
Next Topic: Re: Plotting Axes Over Image.

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

Current Time: Sun Oct 12 09:38:05 PDT 2025

Total time taken to generate the page: 1.51640 seconds