[tz] [PROPOSED 1/7] Avoid undefined behavior if no Link lines
Clive D.W. Feather
clive at davros.org
Wed Oct 26 16:25:14 UTC 2022
Tom Lane via tz said:
> Jonathan Leffler via tz <tz at iana.org> writes:
> > I see nothing in the C standard specification of qsort() that says sorting
> > an array with zero members leads to undefined behaviour.
>
> The C standard is silent on this (at least as of C99), but POSIX is
> absolutely unambiguous:
>
> If the nel argument has the value zero, the comparison function
> pointed to by compar shall not be called and no rearrangement shall
> take place.
But does it say whether the first argument is allowed to be NULL?
--
Clive D.W. Feather | If you lie to the compiler,
Email: clive at davros.org | it will get its revenge.
Web: http://www.davros.org | - Henry Spencer
Mobile: +44 7973 377646
More information about the tz
mailing list