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

Home » Public Forums » archive » Re: keyword_set bug or feature
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: keyword_set bug or feature [message #4212 is a reply to message #4205] Sat, 13 May 1995 00:00 Go to previous messageGo to previous message
rivers is currently offline  rivers
Messages: 228
Registered: March 1991
Senior Member
In article <PHIL.95May12090139@peace.med.ohio-state.edu>, phil@peace.med.ohio-state.edu (Phil) writes:
> Thanks to those who responded to my ? concerning common blocks.
>
> I just can across another 'feature' and was wondering if others felt
> that it is really a 'bug' or if there is some way to over come it. It
> has to do with keywords in functions or procedures. I use several and
> check to see if the are set using
>
> IF NOT(keyowrd_set(key)) THEN BEGIN
> ;set a default value here
> ENDIF
>
> The problem comes in if the user wants to set key = 0. If so then it
> appears to the above test that the keyword is not set even though in
> the function call the user typed
>

keyword_set is intended for use with switches, i.e. parameters which can either
be 0 or 1. 0 or not present means switch not set, 1 means switch set.

If you want to detect that the keyword is present, even if the value is zero,
then you should use n_elements().

____________________________________________________________
Mark Rivers (312) 702-2279 (office)
CARS (312) 702-9951 (secretary)
Univ. of Chicago (312) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars3.uchicago.edu (Internet)
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Plotting to file
Next Topic: Re: Bad pixmap error, pixmap allocation, keywords

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

Current Time: Sat Oct 11 15:00:53 PDT 2025

Total time taken to generate the page: 0.79976 seconds