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

Home » Public Forums » archive » Re: isn't this a bug in RSTRPOS?
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
Re: isn't this a bug in RSTRPOS? [message #10621] Mon, 05 January 1998 00:00
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Russ Welti (rwelti@mapper.mbt.washington.edu) writes:

> IDL> s=["hi","hit","hitter","h"]
> IDL> print,strpos(s,"t")
> -1 2 2 -1
> IDL> print,rstrpos(s,"t")
> % Compiled module: RSTRPOS.
> % Compiled module: REVERSE.
> % Expression must be a scalar in this context: <BYTE Array(4)>.
>
> What gives?

Whoops! My friend, Josh Goldstein, wrote this code a long
time ago. Josh was (probably is, although I haven't seen him
in a long time) one of the best IDL programmers I have ever
seen. He could write IDL code (and always GREAT code) as
fast as I could talk. He wasn't big on testing things, as I
remember. Figuring--I think correctly--that if he wrote it, it
must be right. I was, frankly, in awe of his coding prowess.

But I think he made a mistake here. This code is barfing
on an IF statement. The test condition in an IF statement
must always evaluate to a scalar. This test case cannot
do that. I guess it could be fixed with a FOR loop, but
I can just hear what Josh would have to say about *that*,
so I'm not touching it. :-)

The RSTRPOS source code is in the library.

Cheers,

David

-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL Colors on 24-Bit Displays
Next Topic: isn't this a bug in RSTRPOS?

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

Current Time: Fri Oct 10 06:46:34 PDT 2025

Total time taken to generate the page: 1.92142 seconds