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

Home » Public Forums » archive » Should SORT(Undefined) give an error message?
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
Should SORT(Undefined) give an error message? [message #93037] Wed, 13 April 2016 10:28 Go to next message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
Currently one can SORT() an undefined variable without getting an error message

IDL> sort(undefined)
0

Certainly, the current result is inconsistent with the documentation:

"The result is always a vector of integer type with the same number of elements as Array." since in this case Array has 0 elements.


I think one should get an error message the same way one does with sqrt(undefined) or max(undefined)

In my case, the current behavior slowed down my debugging because I was using the sort index of Vector A to sort another vector B. Vector A was mistakenly undefined but Vector B was valid. Therefore, B[SORT(A)] was also valid, and the program happily proceeded. --Wayne
Re: Should SORT(Undefined) give an error message? [message #93038 is a reply to message #93037] Wed, 13 April 2016 14:03 Go to previous message
Lajos Foldy is currently offline  Lajos Foldy
Messages: 176
Registered: December 2011
Senior Member
On Wednesday, April 13, 2016 at 7:28:13 PM UTC+2, wlandsman wrote:
> Currently one can SORT() an undefined variable without getting an error message
>
> IDL> sort(undefined)
> 0
>
> Certainly, the current result is inconsistent with the documentation:
>
> "The result is always a vector of integer type with the same number of elements as Array." since in this case Array has 0 elements.
>
>
> I think one should get an error message the same way one does with sqrt(undefined) or max(undefined)
>
> In my case, the current behavior slowed down my debugging because I was using the sort index of Vector A to sort another vector B. Vector A was mistakenly undefined but Vector B was valid. Therefore, B[SORT(A)] was also valid, and the program happily proceeded. --Wayne

I think it's a bug. It gives an error message in GDL or FL.

regards,
Lajos
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Looping over odd values only
Next Topic: 3d Interpolation

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

Current Time: Wed Oct 08 07:17:04 PDT 2025

Total time taken to generate the page: 0.00490 seconds