[openbeos] Re: Performance question - BList vs STL list

  • From: Marcus Overhagen <marcusoverhagen@xxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Sun, 23 Oct 2005 11:51:14 +0200 (CEST)

Zenja Solaja <solaja@xxxxxxxxx> wrote:

> Well, I've stumbled onto a bug in BList (SortItems). Examine the following
> code:

> int int_sort(const void *a, const void *b)
> {
> int *c = (int *) a;
> int *d = (int *) d;

This is a bug, you are using the uninitialized d, instead of b. 
The result is undeterminable.

you can also use a much simpler sort:

int int_sort(const void *a, const void *b)
{
    return *(const int*)a - *(const int*)b;
}


regards
Marcus


Machen Sie aus 14 Cent spielend bis zu 100 Euro!
Die neue Gaming-Area von Arcor - über 50 Onlinespiele im Angebot.
http://www.arcor.de/rd/emf-gaming-1

Other related posts: