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

Home » Public Forums » archive » Yet again, The Sky is Falling!
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: Yet again, The Sky is Falling! [message #52940 is a reply to message #52872] Mon, 12 March 2007 15:04 Go to previous messageGo to previous message
Sven Geier is currently offline  Sven Geier
Messages: 17
Registered: July 2002
Junior Member
mgalloy@gmail.com wrote:

> I'm talking about two parameters that are both passed a single named
> variable (like Paul's mypro example). While legal, I don't think this
> is a good technique for clear code.
>

...and as usual there's exceptions where this is a perfectly good thing to
do. I have a routine in front of me that dynamically improves a "guess" of
some number. It takes an input and an output parameter and in almost all
cases you want to give it the same variable there. Schematically like this

x = someOldGuess
improve,x,x

where "improve" takes the first "x" as its input, copies the values to a
local variable, performs a bunch of magic and returns the result in
the "second x". From the outside, the variable "x" simply has a new,
improved value (which is the purpose of "improve'). However, there can be
extreme cases where one might want to have a little more introspection and
where one might want to check the returned value before using it and in
that case one can make it

improve,x,y
if (some test here) then x=y

or such.

I second David's statement that one of the nice things about IDL is that one
can do all these weird things. As someone once said (about C++, I
think) "all the power and all the elegance of a hand grenade": It ain't
always pretty but it gets things done.

- S

--
http://www.sgeier.net
My real email address does not contain any "Z"s.
[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
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: mpeg creation problem
Next Topic: reading many files

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

Current Time: Fri Oct 10 15:32:51 PDT 2025

Total time taken to generate the page: 1.12281 seconds