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

Home » Public Forums » archive » Re: string definition 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: string definition question [message #33603 is a reply to message #33602] Tue, 14 January 2003 12:32 Go to previous messageGo to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
"Paul van Delst" <paul.vandelst@noaa.gov> wrote in message
news:3E2432EC.18E46318@noaa.gov...
> ..
> I'm a bit anal about argument checking in IDL. After establishing that the
correct
> number of arguments has been passed using:
>
> n_arguments = 1
> IF ( N_PARAMS() LT n_arguments ) THEN $
> MESSAGE, 'Invalid number of arguments.', $
> /NONAME, /NOPRINT

I see your actual question has been answered by others, so permit me to take
another tack. Why do you set the NONAME & NOPRINT keywords? And why check
the number of parameters? Isn't it better to check each argument to see that
it's been defined (with N_ELEMENTS) or that it's available for output (with
ARG_PRESENT) as necessary. The additional N_PARAMS check lets you
distinguish arguments that have been given an undefined value from those
that are completely missing; I don't think this is a very interesting
distinction.

I ask because I feel that I have never really sorted out error checking in
IDL. I guess that I lean towards a minimal approach: if a piece of code
requires that a value be defined then I'll learn soon enough if it's not.
(It's the code that silently gives you the wrong answer that you've got to
look out for.)

---
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: string definition question
Next Topic: Re: 2-D Density Plots

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

Current Time: Wed Oct 08 19:21:32 PDT 2025

Total time taken to generate the page: 0.00406 seconds