Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 16 Apr 2022 16:16:26 +0200
From: Quentin Rameau <>
Subject: Re: Detect qsort_r() support with preprocessor


> > Hello musl devs,
> >
> > qsort_r() has been added to musl 1.2.3 and it has been backported to
> > the previous version of musl in Alpine. How can I detect whether this
> > function is available using the preprocessor?
> >
> > The community wiki advocates "testing" for feature support, which I
> > guess means compiling a test program like an autotools configure
> > script.
> Guess why that is. It is more portable to do that way than to define new
> non-standard macros. The only macros musl will define are standard ones.
> > Can we not just test for a macro instead? Have you considered
> > defining something like `__HAS_QSORT_R` to tell us directly that you
> > support it?
> >
> Unless qsort_r() were part of a new release of POSIX (then you could
> look at _POSIX_VERSION), or a member of an option group (then you could
> look at the option group macro), not really.

Just as a note, qsort_r() has indeed been added to POSIX-next, so you'd
only need to ask for _POSIX_C_SOURCE with a value of 20XXXX, when it's
actually been released.

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.