Hi,
When I use the C++ function qsort, it hangs when the data contains duplicated values. Here is an example
unsigned char Array[] = {0,5,7,1,3,9,5}; int BCompare(const void* a, const void* b) { return(*(u8*)a - *(u8*)b); } void main(void) { int i; printf("\n\rBefore Sort"); for (i=0;i<7;i++) printf("%d,",Array[i]); qsort(Array, 7, sizeof(u8), BCompare); printf("\n\rAfter Sort"); for (i=0;i<7;i++) printf("%d,",Array[i]); }
With Array containing unique numbers, the sortfunction is OK Any idea ?
Kind regards Luc Vercruysse
Tool Version Numbers: Toolchain: RealView MDK-ARM Version: 3.15b Toolchain Path: BIN31\ C Compiler: Armcc.Exe V3.1.0.914 Assembler: Armasm.Exe V3.1.0.914 Linker/Locator: ArmLink.Exe V3.1.0.914 Librarian: ArmAr.Exe V3.1.0.914 Hex Converter: FromElf.Exe V3.1.0.914 CPU DLL: SARM.DLL V3.15b Dialog DLL: DARMST9.DLL V1.03 Target DLL: BIN\UL2ARM.DLL V1.32 Dialog DLL: TARMST9.DLL V1.01a