405. qsort and POD

Section: 26.13 [alg.c.library] Status: CD1 Submitter: Ray Lischner Opened: 2003-04-08 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [alg.c.library].

View all issues with CD1 status.

Discussion:

Section 26.13 [alg.c.library] describes bsearch and qsort, from the C standard library. Paragraph 4 does not list any restrictions on qsort, but it should limit the base parameter to point to POD. Presumably, qsort sorts the array by copying bytes, which requires POD.

Proposed resolution:

In 26.13 [alg.c.library] paragraph 4, just after the declarations and before the nonnormative note, add these words: "both of which have the same behavior as the original declaration. The behavior is undefined unless the objects in the array pointed to by base are of POD type."

[Something along these lines is clearly necessary. Matt provided wording.]