<html><head></head><body>I am more concerned about the real problem that some craptastic libc do not provide <threads.h> and thus thread_local, than that the compiler does not support C11.<br><br><div class="gmail_quote">Le 22 janvier 2019 12:12:46 GMT+02:00, "Hugo Beauzée-Luyssen" <hugo@beauzee.fr> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail"><br><br>On Tue, Jan 22, 2019, at 10:34 AM, Thomas Guillem wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">On Mon, Jan 21, 2019, at 18:09, Hugo Beauzée-Luyssen wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;">Any reason not to use "thread_local" ?<br></blockquote>No, no idea, just copied the code from Rémi compat code.<br><br></blockquote><br>Since _Thread_local might be missing on some platform, I'd be in favor of using thread_local instead<br><br>> > <br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;">+{<br>+    int (*compar)(const void *, const void *, void *);<br>+    void *arg;<br>+} state;<br>+<br>+static int compar_wrapper(const void *a, const void *b)<br>+{<br>+    return state.compar(a, b, state.arg);<br>+}<br>+<br>+/* Follow the upcoming POSIX prototype, coming from GNU/libc.<br>+ * Note that this differs from the BSD prototype. */<br>+<br>+VLC_WEAK void vlc_qsort(void *base, size_t nmemb, size_t size,<br>+                        int (*compar)(const void *, const void *, void *),<br>+                        void *arg)<br></blockquote>Any particular reason to use VLC_WEAK instead of the usual per-platform <br>implementation?<br></blockquote>It's more future proof for me. We could add more utility functions to <br>misc/utils.c. Some of these functions could be implemented differently <br>depending of the OS or not. With VLC_WEAK, we don't have to play with <br>conditions in the Makefile.am, this seems more convenient.<br><br></blockquote><br>Fair enough, the question is mostly that we don't use it much but more often use multiple source files. Your point is very valid IMO, I just find weak symbols harder to reason about, or less intuitive, than a plain different source file, but I'm absolutely fine with your solution :)<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">As you want, I don't have strong opinions about wether we should use <br>VLC_WEAK in that case.<br><br></blockquote><br></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>