On 04/10/2016 23:31, René Scharfe wrote:
So let's summarize; here's the effect of a raw qsort(3) call:
array == NULL nmemb bug QSORT following NULL check
- - --- -
0 0 no qsort is skipped
0 >0 no qsort is
Am 04.10.2016 um 07:28 schrieb Kevin Bracey:
On 04/10/2016 01:00, René Scharfe wrote:
Am 03.10.2016 um 19:09 schrieb Kevin Bracey:
As such, NULL checks can still be elided even with your change. If you
effectively change your example to:
if (nmemb > 1)
qsort(array, nmemb, size, cmp
On 04/10/2016 01:00, René Scharfe wrote:
Am 03.10.2016 um 19:09 schrieb Kevin Bracey:
As such, NULL checks can still be elided even with your change. If you
effectively change your example to:
if (nmemb > 1)
qsort(array, nmemb, size, cmp);
if (!array)
printf("array is NU
Am 03.10.2016 um 19:09 schrieb Kevin Bracey:
As such, NULL checks can still be elided even with your change. If you
effectively change your example to:
if (nmemb > 1)
qsort(array, nmemb, size, cmp);
if (!array)
printf("array is NULL\n");
array may only be checked for NUL
On 01/10/2016 19:19, René Scharfe wrote:
It's hard to imagine an implementation of qsort(3) that can't handle
zero elements. QSORT's safety feature is that it prevents the compiler
from removing NULL checks for the array pointer. E.g. the last two
lines in the following example could be optimiz
On 01/10/2016 19:19, René Scharfe wrote:
It's hard to imagine an implementation of qsort(3) that can't handle
zero elements. QSORT's safety feature is that it prevents the compiler
from removing NULL checks for the array pointer. E.g. the last two
lines in the following example could be optimi
Am 30.09.2016 um 00:36 schrieb Junio C Hamano:
> 3. builtin/show-branch.c does this:
>
> qsort(ref_name + bottom, top - bottom, sizeof(ref_name[0]),
> compare_ref_name);
>
> where ref_name[] is a file-scope global:
>
> static char *ref_name[MAX_REVS + 1];
>
> and top and botto
Am 30.09.2016 um 01:21 schrieb René Scharfe:
> Am 30.09.2016 um 00:36 schrieb Junio C Hamano:
>> René Scharfe writes:
>>
>>> Add the macro QSORT, a convenient wrapper for qsort(3) that infers the
>>> size of the array elements and supports the convention of initializing
>>> empty arrays with a NUL
Am 30.09.2016 um 00:36 schrieb Junio C Hamano:
> René Scharfe writes:
>
>> Add the macro QSORT, a convenient wrapper for qsort(3) that infers the
>> size of the array elements and supports the convention of initializing
>> empty arrays with a NULL pointer, which we use in some places.
>>
>> Calli
René Scharfe writes:
> Add the macro QSORT, a convenient wrapper for qsort(3) that infers the
> size of the array elements and supports the convention of initializing
> empty arrays with a NULL pointer, which we use in some places.
>
> Calling qsort(3) directly with a NULL pointer is undefined --
Add the macro QSORT, a convenient wrapper for qsort(3) that infers the
size of the array elements and supports the convention of initializing
empty arrays with a NULL pointer, which we use in some places.
Calling qsort(3) directly with a NULL pointer is undefined -- even with
an element count of z
11 matches
Mail list logo