Let us consider this error in detail. At the moment of writing this post, the last revision of the file "lib/libc/stdlib/qsort.c" included into OpenBSD 4.6. dates back to August, 2005. There, the function qsort employs the auxiliary variables "d" and "r" that have the type int:
void qsort(void *aa, size_t n, size_t es, int (*cmp)(const void *, const void *)) { char *pa, *pb, *pc, *pd, *pl, *pm, *pn; int d, r, swaptype, swap_cnt; char *a = aa; . . . .You may see the full text of the function here.
These variables are used to store different sizes and it leads to errors when processing a large number of items. The correction lies in declaring these variables as size_t:
size_t d, r;This error is exemplary because it was detected only in 2010! It seems that a large number of errors in 64-bit programs will begin to occur when a standard user computer has more than 16 Gbytes of memory and programs begin to exploit it very actively.
Комментариев нет:
Отправить комментарий