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

Home » Public Forums » archive » gotcha: indexing into a scalor
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
gotcha: indexing into a scalor [message #7886] Fri, 17 January 1997 00:00
paul is currently offline  paul
Messages: 22
Registered: June 1991
Junior Member
I am using IDL Version 3.6 (ultrix mipsel).
I've discovered an IDL "feature" that caused me a bit of grief.

try the following code segment,

x=0
i=indgen(9)
x(i)=findgen(9)
print,x
8

help,x
X INT = 8

print,x(i)
8 8 8 8 8 8 8 8 8


My error was to set x to a scalor in the first line. As you can see
that one mistake led to some rather bizarre behaviour. I had thought
IDL would issue an error message if I tried to use an index array with
a scalor. But, this example shows that scalors will accept index
arrays with no complaint. Now I realize this is part of the IDL
subscripting rule that subscript arrays are not bounds-checked before
use. What is surprising is that the rule extends to single element
arrays (scalors).

Is this feature carried over to latter versions of IDL?



--

____________________________________________________________ _______________
Paul Ricchiazzi
Institute for Computational Earth System Science (ICESS)
University of California, Santa Barbara

email: paul@icess.ucsb.edu
____________________________________________________________ _______________
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: calling a user-named procedure
Next Topic: Recordable CD's for Sale

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

Current Time: Wed Oct 08 19:00:10 PDT 2025

Total time taken to generate the page: 0.00567 seconds