qsort - weird behaviour ...

When porting the new mkisofs (from cdr-tools-2.0) to neutrino, I found
a wierd behaviour of the qsort() function:

Sometimes it calls the compare function with both pointers beeing
identical, which is pretty senseless. I also couldn’t reproduce this
on other platforms (QNX4, Linux), so I’d like to call it a bug :slight_smile:.

Any comments?



Here’s a sample C file, that illustrates the problem:
The larger you choose ARRAY_SIZE, the mort “Identical pointers!” youe
get.



#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifndef ARRAY_SIZE
#define ARRAY_SIZE 33
#endif

int compare ( const void* l, const void* r )
{
const char** ll = (const char**) l;
const char** rr = (const char**) r;

if ( l == r )
{
printf(“Identical pointers!\n”);
return 0;
}
return strcmp ( *ll, rr );
}




int main ( int argc, char
argv[] )
{
const int n = ARRAY_SIZE;

char* array[ARRAY_SIZE];

int i;


printf("------------------------ Original\n");
for ( i = 0; i < n; i++)
{
array [ i ] = strdup ( tmpnam ( NULL ) );
printf ( “%s\n”, array_);
}



printf( “------------------------ Sortieren\n”);
qsort ( array, n, sizeof(char * ), compare );

printf( “------------------------ Sortiert!\n”);
for ( i = 0; i < n; i++)
{
printf ( “%s\n”, array);
}

return 0;
}



\


| / | __ ) | Karsten.Hoffmann@mbs-software.de MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld_

It is a known bug of QNX qsort. Bit me when porting PostgreSQL too.

<Karsten.Hoffmann@mbs-software.de> wrote in message
news:b49qco$pmo$1@mbs-software.de

When porting the new mkisofs (from cdr-tools-2.0) to neutrino, I found
a wierd behaviour of the qsort() function:

Sometimes it calls the compare function with both pointers beeing
identical, which is pretty senseless. I also couldn’t reproduce this
on other platforms (QNX4, Linux), so I’d like to call it a bug > :slight_smile:> .

Any comments?



Here’s a sample C file, that illustrates the problem:
The larger you choose ARRAY_SIZE, the mort “Identical pointers!” youe
get.



#include <stdio.h
#include <stdlib.h
#include <string.h

#ifndef ARRAY_SIZE
#define ARRAY_SIZE 33
#endif

int compare ( const void* l, const void* r )
{
const char** ll = (const char**) l;
const char** rr = (const char**) r;

if ( l == r )
{
printf(“Identical pointers!\n”);
return 0;
}
return strcmp ( *ll, rr );
}




int main ( int argc, char
argv[] )
{
const int n = ARRAY_SIZE;

char* array[ARRAY_SIZE];

int i;


printf("------------------------ Original\n");
for ( i = 0; i < n; i++)
{
array [ i ] = strdup ( tmpnam ( NULL ) );
printf ( “%s\n”, array> _);
}



printf( “------------------------ Sortieren\n”);
qsort ( array, n, sizeof(char * ), compare );

printf( “------------------------ Sortiert!\n”);
for ( i = 0; i < n; i++)
{
printf ( “%s\n”, array> );
}

return 0;
}



\


| / | __ ) | > Karsten.Hoffmann@mbs-software.de > MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld_

Igor Kovalenko <kovalenko@attbi.com> wrote:

It is a known bug of QNX qsort. Bit me when porting PostgreSQL too.

Nice to hear, tha I’m not the only one :slight_smile:)

How did you solve it? I just ignore it, better say treat them a equal
and return a 0.


| / | __ ) | Karsten.Hoffmann@mbs-software.de MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld

There’s not much choice how to solve it. Something like #ifdef QNX

<Karsten.Hoffmann@mbs-software.de> wrote in message
news:b4hkd2$c0j$1@mbs-software.de

Igor Kovalenko <> kovalenko@attbi.com> > wrote:
It is a known bug of QNX qsort. Bit me when porting PostgreSQL too.

Nice to hear, tha I’m not the only one > :slight_smile:> )

How did you solve it? I just ignore it, better say treat them a equal
and return a 0.


| / | __ ) | > Karsten.Hoffmann@mbs-software.de > MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld

You can always create a qsort.c file with a working routine and place it
with your code (assuming you’re using QNX makefiles). The new routine
will override the one in libc.

Daryl Low

Igor Kovalenko wrote:

There’s not much choice how to solve it. Something like #ifdef QNX

Karsten.Hoffmann@mbs-software.de> > wrote in message
news:b4hkd2$c0j$> 1@mbs-software.de> …

Igor Kovalenko <> kovalenko@attbi.com> > wrote:

It is a known bug of QNX qsort. Bit me when porting PostgreSQL too.

Nice to hear, tha I’m not the only one > :slight_smile:> )

How did you solve it? I just ignore it, better say treat them a equal
and return a 0.


| / | __ ) | > Karsten.Hoffmann@mbs-software.de > MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld

Yay! We could also replace many other functions.
I am actually thinking about replacing MsgXXX family :stuck_out_tongue:

“Daryl Low” <dlo*w@qnx.com> wrote in message
news:3E6CCDC9.8060608@qnx.com

You can always create a qsort.c file with a working routine and place it
with your code (assuming you’re using QNX makefiles). The new routine
will override the one in libc.

Daryl Low

Igor Kovalenko wrote:
There’s not much choice how to solve it. Something like #ifdef QNX

Karsten.Hoffmann@mbs-software.de> > wrote in message
news:b4hkd2$c0j$> 1@mbs-software.de> …

Igor Kovalenko <> kovalenko@attbi.com> > wrote:

It is a known bug of QNX qsort. Bit me when porting PostgreSQL too.

Nice to hear, tha I’m not the only one > :slight_smile:> )

How did you solve it? I just ignore it, better say treat them a equal
and return a 0.


| / | __ ) | > Karsten.Hoffmann@mbs-software.de > MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld

\

Igor Kovalenko <kovalenko@attbi.com> wrote:

Yay! We could also replace many other functions.
I am actually thinking about replacing MsgXXX family :stuck_out_tongue:

It’s not too hard, to find a working copy of a 40 years old
algorithm, even in my good’ole K&R I can find one :slight_smile:.

But sometime I wonder, why this stuff is so expensive …


| / | __ ) | Karsten.Hoffmann@mbs-software.de MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld

Igor Kovalenko <> kovalenko@attbi.com> > wrote:
Yay! We could also replace many other functions.
I am actually thinking about replacing MsgXXX family :stuck_out_tongue:

It’s not too hard, to find a working copy of a 40 years old
algorithm, even in my good’ole K&R I can find one > :slight_smile:> .

But sometime I wonder, why this stuff is so expensive …

If it is wrong on QNX, it is wrong because the head of the Standard
C library committe wrote it wrong. :wink: Now, in my reading of the C
standard nothing says that qsort() cannot call it’s comparison function
for the same element.

I have not studied the Dinkum code for qsort, so I cannot try to explain why
it would bother calling the comparision function on the same element, other
then to avoid checking every single time before the compare is called.

How did this break your port igor?

chris


Chris McKillop <cdm@qnx.com> “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/

Karsten.Hoffmann@mbs-software.de wrote:

When porting the new mkisofs (from cdr-tools-2.0) to neutrino, I found
a wierd behaviour of the qsort() function:

Sometimes it calls the compare function with both pointers beeing
identical, which is pretty senseless. I also couldn’t reproduce this
on other platforms (QNX4, Linux), so I’d like to call it a bug > :slight_smile:> .

Any comments?

Well, I commented further down the thread. Gonna comment here though.

Doing some more tests it seems the number of times that the same pointer used
is dependant on the data set being sorted. I changed your strdup(tmpnam())
to a strdup( sprintf( buf, “%d%d%d%d%d%d”, rand() … ) ) to give a more
random set of values (both within the test set and between tests) and, in
turn, got a variable number of calls with l==r.

In my test case, with a million elements it called the test function on
the same element about 55,000 times. Now, given that qsort() is O(n log n)
on average that means it avoided a possible 5,945,000 compares in the core
of the algorithim, more then likely many more.

With further reading, I belive this might be a side effect of attempting
to do a balancing pass to avoid qsort’s O(n**n) worst case running time.

So, no, I don’t think it is a bug.

chris


Chris McKillop <cdm@qnx.com> “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/

For your amusement, then, here is quicksort in my favourite programming
language:

op qsort (t); – sort tuple t
if #t <= 1 then
return t; – t is empty or a singleton
end if;
a := random t; – pick random element of t
return qsort [e in t | e < a] +
[e in t | e = a] +
qsort [e in t | e > a];
end op;

dB

<Karsten.Hoffmann@mbs-software.de> wrote in message
news:b4o9ps$rr2$1@mbs-software.de

Igor Kovalenko <> kovalenko@attbi.com> > wrote:
Yay! We could also replace many other functions.
I am actually thinking about replacing MsgXXX family :stuck_out_tongue:

It’s not too hard, to find a working copy of a 40 years old
algorithm, even in my good’ole K&R I can find one > :slight_smile:> .

But sometime I wonder, why this stuff is so expensive …


| / | __ ) | > Karsten.Hoffmann@mbs-software.de > MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld

“Chris McKillop” <cdm@qnx.com> wrote in message
news:b4p6sd$h87$1@nntp.qnx.com

Igor Kovalenko <> kovalenko@attbi.com> > wrote:
Yay! We could also replace many other functions.
I am actually thinking about replacing MsgXXX family :stuck_out_tongue:

It’s not too hard, to find a working copy of a 40 years old
algorithm, even in my good’ole K&R I can find one > :slight_smile:> .

But sometime I wonder, why this stuff is so expensive …


If it is wrong on QNX, it is wrong because the head of the Standard
C library committe wrote it wrong. > :wink: > Now, in my reading of the C
standard nothing says that qsort() cannot call it’s comparison function
for the same element.

I have not studied the Dinkum code for qsort, so I cannot try to explain
why
it would bother calling the comparision function on the same element,
other
then to avoid checking every single time before the compare is called.

How did this break your port igor?

Apparently Postgres does not like that for some reason. I don’t remember off
the top of my head, but it caused some grief (failing some regression
tests). Off all the platforms supported (and there’s a lot) only QNX needed
a patch for that.

– igor

David Bacon <dbacon@qnx.com> wrote:

For your amusement, then, here is quicksort in my favourite programming
language:

op qsort (t); – sort tuple t
if #t <= 1 then
return t; – t is empty or a singleton
end if;
a := random t; – pick random element of t
return qsort [e in t | e < a] +
[e in t | e = a] +
qsort [e in t | e > a];
end op;

Now how about an APL version? :slight_smile:

Ok, I’ll show my ignorance; which language was that? I’ll further
show my ignorance and guess lisp. :slight_smile:

Cheers,
-RK

dB

Karsten.Hoffmann@mbs-software.de> > wrote in message
news:b4o9ps$rr2$> 1@mbs-software.de> …
Igor Kovalenko <> kovalenko@attbi.com> > wrote:
Yay! We could also replace many other functions.
I am actually thinking about replacing MsgXXX family :stuck_out_tongue:

It’s not too hard, to find a working copy of a 40 years old
algorithm, even in my good’ole K&R I can find one > :slight_smile:> .

But sometime I wonder, why this stuff is so expensive …


| / | __ ) | > Karsten.Hoffmann@mbs-software.de > MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld


Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.

The mystery language is SETL.

APL would certainly allow a terse solution too, though the result would not
be so readable even if I could conveniently use its character set in
newsgroup postings!

I have nothing but admiration for your ignorance of Lisp, although
Lisp/Scheme also afford rather elegant formulations of this obviously very
recursive algorithm.

And now we are truly OT… :slight_smile:

dB

Robert Krten <nospam84@parse.com> wrote in message
news:b4sjer$fd$1@inn.qnx.com

David Bacon <> dbacon@qnx.com> > wrote:
For your amusement, then, here is quicksort in my favourite programming
language:

op qsort (t); – sort tuple t
if #t <= 1 then
return t; – t is empty or a singleton
end if;
a := random t; – pick random element of t
return qsort [e in t | e < a] +
[e in t | e = a] +
qsort [e in t | e > a];
end op;

Now how about an APL version? > :slight_smile:

Ok, I’ll show my ignorance; which language was that? I’ll further
show my ignorance and guess lisp. > :slight_smile:

Cheers,
-RK

dB

Karsten.Hoffmann@mbs-software.de> > wrote in message
news:b4o9ps$rr2$> 1@mbs-software.de> …
Igor Kovalenko <> kovalenko@attbi.com> > wrote:
Yay! We could also replace many other functions.
I am actually thinking about replacing MsgXXX family :stuck_out_tongue:

It’s not too hard, to find a working copy of a 40 years old
algorithm, even in my good’ole K&R I can find one > :slight_smile:> .

But sometime I wonder, why this stuff is so expensive …


| / | __ ) | > Karsten.Hoffmann@mbs-software.de > MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld


\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at > www.parse.com> .
Email my initials at parse dot com.

Igor Kovalenko <kovalenko@attbi.com> wrote:

“Chris McKillop” <> cdm@qnx.com> > wrote in message
news:b4p6sd$h87$> 1@nntp.qnx.com> …

How did this break your port igor?


Apparently Postgres does not like that for some reason. I don’t remember off
the top of my head, but it caused some grief (failing some regression
tests). Off all the platforms supported (and there’s a lot) only QNX needed
a patch for that.

The same applies to my ‘mkisofs’: identical items in the
list made the utility complain about ‘identical files’ and then
it terminated. Also here QNX obviosly is the only OS that needs a
patch …


| / | __ ) | Karsten.Hoffmann@mbs-software.de MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld

Chris McKillop <cdm@qnx.com> wrote:

With further reading, I belive this might be a side effect of attempting
to do a balancing pass to avoid qsort’s O(n**n) worst case running time.

So, no, I don’t think it is a bug.

Well, at least it’s unique to QNX6 (did you check your example against
the QNX4-libraries?) and that’s, why I called it ‘wierd’ in the
subject :slight_smile: .

It’s only nasty, when porting …

Perhaps it should be mentioned in the docs.


| / | __ ) | Karsten.Hoffmann@mbs-software.de MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld

David Bacon wrote:

The mystery language is SETL.

APL would certainly allow a terse solution too, though the result would not
be so readable even if I could conveniently use its character set in
newsgroup postings!

I have nothing but admiration for your ignorance of Lisp, although
Lisp/Scheme also afford rather elegant formulations of this obviously very
recursive algorithm.

Oh oh, does this mean if we knew it wasn’t Lisp, we know too much Lisp?



And now we are truly OT… > :slight_smile:

dB

So at least point us to some URLs for SETL, already! I’ve never heard
of it.
And thank you, Robert, for letting me be second to admit my ignorance…


Phil Olynyk

Robert Krten <> nospam84@parse.com> > wrote in message
news:b4sjer$fd$> 1@inn.qnx.com> …
David Bacon <> dbacon@qnx.com> > wrote:
For your amusement, then, here is quicksort in my favourite programming
language:

op qsort (t); – sort tuple t
if #t <= 1 then
return t; – t is empty or a singleton
end if;
a := random t; – pick random element of t
return qsort [e in t | e < a] +
[e in t | e = a] +
qsort [e in t | e > a];
end op;

Now how about an APL version? > :slight_smile:

Ok, I’ll show my ignorance; which language was that? I’ll further
show my ignorance and guess lisp. > :slight_smile:

Cheers,
-RK

dB

Karsten.Hoffmann@mbs-software.de> > wrote in message
news:b4o9ps$rr2$> 1@mbs-software.de> …
Igor Kovalenko <> kovalenko@attbi.com> > wrote:
Yay! We could also replace many other functions.
I am actually thinking about replacing MsgXXX family :stuck_out_tongue:

It’s not too hard, to find a working copy of a 40 years old
algorithm, even in my good’ole K&R I can find one > :slight_smile:> .

But sometime I wonder, why this stuff is so expensive …


| / | __ ) | > Karsten.Hoffmann@mbs-software.de > MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld


\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at > www.parse.com> .
Email my initials at parse dot com.

Regrettably the links Google turns up are obsolete, but you can find the
main documentation for my SETL implementation (and some more references) at

http://cs1.cs.nyu.edu/bacon/birch/html/bacon/doc.html

I am planning to release the source at some point. Meanwhile, I use SETL
heavily on QNX and other Unix systems, and will release the QNX binaries
once I have finished working around some QNX bugs.

dB

Phil Olynyk <pholynyk@rogers.com> wrote in message
news:3E7357F1.FAE00477@rogers.com

David Bacon wrote:

The mystery language is SETL.

APL would certainly allow a terse solution too, though the result would
not
be so readable even if I could conveniently use its character set in
newsgroup postings!

I have nothing but admiration for your ignorance of Lisp, although
Lisp/Scheme also afford rather elegant formulations of this obviously
very
recursive algorithm.

Oh oh, does this mean if we knew it wasn’t Lisp, we know too much Lisp?

And now we are truly OT… > :slight_smile:

dB

So at least point us to some URLs for SETL, already! I’ve never heard
of it.
And thank you, Robert, for letting me be second to admit my ignorance…


Phil Olynyk


Robert Krten <> nospam84@parse.com> > wrote in message
news:b4sjer$fd$> 1@inn.qnx.com> …
David Bacon <> dbacon@qnx.com> > wrote:
For your amusement, then, here is quicksort in my favourite
programming
language:

op qsort (t); – sort tuple t
if #t <= 1 then
return t; – t is empty or a singleton
end if;
a := random t; – pick random element of t
return qsort [e in t | e < a] +
[e in t | e = a] +
qsort [e in t | e > a];
end op;

Now how about an APL version? > :slight_smile:

Ok, I’ll show my ignorance; which language was that? I’ll further
show my ignorance and guess lisp. > :slight_smile:

Cheers,
-RK

dB

Karsten.Hoffmann@mbs-software.de> > wrote in message
news:b4o9ps$rr2$> 1@mbs-software.de> …
Igor Kovalenko <> kovalenko@attbi.com> > wrote:
Yay! We could also replace many other functions.
I am actually thinking about replacing MsgXXX family :stuck_out_tongue:

It’s not too hard, to find a working copy of a 40 years old
algorithm, even in my good’ole K&R I can find one > :slight_smile:> .

But sometime I wonder, why this stuff is so expensive …


| / | __ ) | > Karsten.Hoffmann@mbs-software.de > MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten
Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse
15
|| ||// Mobile: +49-172-3812373 D-47809
Krefeld


\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at > www.parse.com> .
Email my initials at parse dot com.

In article <b4ui5g$akb$1@mbs-software.de>, Karsten.Hoffmann@mbs-software.de says…

The same applies to my ‘mkisofs’:

What will be different in your ‘mkisofs’ and mkisofs ported by Akhilesh Mritunjai?

http://www.qnxzone.com/~mritun/

Eduard.

Wow! That’s quite extensive. I’ve bookmarked it and will come back to
it.

Thanks, David.

Phil Olynyk
OBT Software Corp.

David Bacon wrote:

Regrettably the links Google turns up are obsolete, but you can find the
main documentation for my SETL implementation (and some more references) at

http://cs1.cs.nyu.edu/bacon/birch/html/bacon/doc.html

I am planning to release the source at some point. Meanwhile, I use SETL
heavily on QNX and other Unix systems, and will release the QNX binaries
once I have finished working around some QNX bugs.

dB

Phil Olynyk <> pholynyk@rogers.com> > wrote in message
news:> 3E7357F1.FAE00477@rogers.com> …
David Bacon wrote:

The mystery language is SETL.

APL would certainly allow a terse solution too, though the result would
not
be so readable even if I could conveniently use its character set in
newsgroup postings!

I have nothing but admiration for your ignorance of Lisp, although
Lisp/Scheme also afford rather elegant formulations of this obviously
very
recursive algorithm.

Oh oh, does this mean if we knew it wasn’t Lisp, we know too much Lisp?

And now we are truly OT… > :slight_smile:

dB

So at least point us to some URLs for SETL, already! I’ve never heard
of it.
And thank you, Robert, for letting me be second to admit my ignorance…


Phil Olynyk


Robert Krten <> nospam84@parse.com> > wrote in message
news:b4sjer$fd$> 1@inn.qnx.com> …
David Bacon <> dbacon@qnx.com> > wrote:
For your amusement, then, here is quicksort in my favourite
programming
language:

op qsort (t); – sort tuple t
if #t <= 1 then
return t; – t is empty or a singleton
end if;
a := random t; – pick random element of t
return qsort [e in t | e < a] +
[e in t | e = a] +
qsort [e in t | e > a];
end op;

Now how about an APL version? > :slight_smile:

Ok, I’ll show my ignorance; which language was that? I’ll further
show my ignorance and guess lisp. > :slight_smile:

Cheers,
-RK

dB

Karsten.Hoffmann@mbs-software.de> > wrote in message
news:b4o9ps$rr2$> 1@mbs-software.de> …
Igor Kovalenko <> kovalenko@attbi.com> > wrote:
Yay! We could also replace many other functions.
I am actually thinking about replacing MsgXXX family :stuck_out_tongue:

It’s not too hard, to find a working copy of a 40 years old
algorithm, even in my good’ole K&R I can find one > :slight_smile:> .

But sometime I wonder, why this stuff is so expensive …


| / | __ ) | > Karsten.Hoffmann@mbs-software.de > MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten
Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse
15
|| ||// Mobile: +49-172-3812373 D-47809
Krefeld


\

Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at > www.parse.com> .
Email my initials at parse dot com.

ed1k <ed1k@humber.bay> wrote:

In article <b4ui5g$akb$> 1@mbs-software.de> >, > Karsten.Hoffmann@mbs-software.de > says…

The same applies to my ‘mkisofs’:

What will be different in your ‘mkisofs’ and mkisofs ported by Akhilesh Mritunjai?

Probably the version …

I don’t remember, who ported the V1.14, that was part of the first NC
or Third Party CD, but that release had problems to create Rockridge
CDs, that could be read by the neutrino devb-eide (it ran READY).

So I just tried the cdrtools 2.0 version, we use with QNX4.


| / | __ ) | Karsten.Hoffmann@mbs-software.de MBS-GmbH
| |/| | _ _
\ Phone : +49-2151-7294-38 Karsten Hoffmann
| | | | |
) |__) | Fax : +49-2151-7294-50 Roemerstrasse 15
|| ||// Mobile: +49-172-3812373 D-47809 Krefeld