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

Home » Public Forums » archive » Array indexing surprises
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
Array indexing surprises [message #72483] Tue, 07 September 2010 15:01
Larry Kneller is currently offline  Larry Kneller
Messages: 2
Registered: September 2010
Junior Member
I received this question from a guy I work with.

The main thing I can't explain here is that if I index an array with
too big
a number where the index is an array, then it behaves as though there
is
no problem.

Here is an example program to illustrate:


pro jrdc_colors

color=['red','white','blue']

icol=[3]
print,color[icol] ; blue
; NO ERROR, NO CRASH IN IDL 7 or 8!

icol2 = [-3,-2,-1,0,1,2,3,4]
print,color[icol2] ; red red red white blue blue blue

print,color[-3] ; blue
print,color[-2] ; white
print,color[-1] ; red

print,color[3] ; ERROR IN IDL 7 AND 8
end

I don't know whether this is a bug or it is working as
planned. It seems like the first two examples in this
code will cause problems with where statements.

-Larry
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL invoked by cron, turning into zombie (hanging, not crashing)
Next Topic: Re: Array indexing surprises

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

Current Time: Wed Oct 08 15:07:36 PDT 2025

Total time taken to generate the page: 0.00413 seconds