Ticket #39251

qsort_s has arguments from MSVC, not from C11 standard or GCC

Open Date: 2019-05-23 21:08 Last Update: 2019-05-24 04:54

Reporter:
Owner:
(None)
Type:
Status:
Closed
Component:
(None)
MileStone:
(None)
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Won't Fix
File:
None
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

Details

The C11 standard introduced a sorting function qsort_s, which accepts an extra argument as data that is passed to the sorting function. In GCC and standard C11, the comparison function that is passed to qsort_s has this new data argument as the last argument, while MSVC has it as the first argument. Mingw seems to have taken the MSVC function declaration instead of the standard one.

Ticket History (2/2 Histories)

2019-05-23 21:08 Updated by: david-cortes
  • New Ticket "qsort_s has arguments from MSVC, not from C11 standard or GCC" created
2019-05-24 04:54 Updated by: keith
  • Resolution Update from None to Won't Fix
  • Status Update from Open to Closed
Comment

The C11 standard introduced a sorting function qsort_s

That is in Annex K, which makes it optional; MinGW does not provide it, isn't required to provided it, and isn't likely to do so.

Mingw seems to have taken the MSVC function declaration instead of the standard one

No, it hasn't; you will not find a declaration for qsort_s() in any genuine MinGW header. (You may find the symbol in a MinGW libmsvcrt.a import library, but there is no corresponding declaration in any MinGW header file). In any case, since MinGW uses the Microsoft MSVCRT runtime library, if the interface were to be exposed, it would relate to the MSVCRT.DLL implementation, so the MSVC semantics would be correct. Blame Microsoft for adopting their own standards; from a MinGW perspective, this is a definite "won't fix".

(Edited, 2019-05-24 04:57 Updated by: keith)

Attachment File List

No attachments

Edit

Please login to add comment to this ticket » Login