builtin sort

Jonathan M Davis jmdavisProg at gmx.com
Sat Jun 8 01:51:38 PDT 2013


On Saturday, June 08, 2013 10:30:52 Stephan Schiffels wrote:
> Hi,
> 
> I know it has been discussed previously to deprecate the builtin
> sort. I don't know the status of this, but I observed the
> following problem.
> 
> With dmd, druntime and phobos all on 2.063, this program runs
> successfully on a mac:
> 
> #!/usr/bin/env rdmd
> 
> import std.stdio;
> 
> void main() {
> 
>    int[] a = [5, 4, 3, 2, 1];
> 
>    a.sort;
>    writeln(a);
> 
> }
> 
> But it fails on linux, with the line:
> 
> 
> /nfs/users/nfs_s/ss27/Software/dlang/phobos/generated/linux/release/64/libph
> obos2.a(qsort_4c4_2cc.o): In function `_adSort':
> src/rt/qsort.d:(.text._adSort+0x47): undefined reference to
> `qsort_r'
> collect2: ld returned 1 exit status
> --- errorlevel 1
> 
> 
> When I change "a.sort" -> "a.sort()" and add import std.algorithm
> everything works fine.
> Does this mean that the builtin sort on Linux is broken with
> 2.063?

Hmm, it works just fine on my system (64-bit Linux), so I don't know why you're 
seeing the problem that you're seeing.

However, we really, really need to deprecate the built-in sort - especially 
when a pair of parens can make the difference between whether you call the 
built-in sort or std.algorithm's sort - and it's particularly broken with 
regards to Unicode.

- Jonathan M Davis


More information about the Digitalmars-d mailing list