<html><head></head><body>A Boolean is confusing because it is not intrinsically obvious which way it goes. But that is not really the main problem.<br><br><div class="gmail_quote">Le 2 juillet 2018 17:43:12 GMT+03:00, Thomas Guillem <thomas@gllm.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>On Sun, Jul 1, 2018, at 21:19, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> Le sunnuntaina 1. heinäkuuta 2018, 22.10.20 EEST Romain Vimont a écrit :<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> On Sun, Jul 01, 2018 at 09:48:03PM +0300, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;"> Le sunnuntaina 1. heinäkuuta 2018, 20.56.03 EEST Romain Vimont a écrit :<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #fcaf3e; padding-left: 1ex;"> On Sun, Jul 01, 2018 at 08:10:54PM +0300, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #e9b96e; padding-left: 1ex;"> Le sunnuntaina 1. heinäkuuta 2018, 12.30.33 EEST Romain Vimont a écrit <br></blockquote></blockquote></blockquote></blockquote> :<br><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;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #fcaf3e; padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #e9b96e; padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ccc; padding-left: 1ex;"> On Sun, Jul 01, 2018 at 11:59:08AM +0300, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ccc; padding-left: 1ex;"> Furthermore the boolean evaluation of the return value is the<br> opposite<br> of<br> what any other ref counting API does (other than VLC's). Usually,<br> zero<br> is<br> for last reference and non-zero for non-last references. Again,<br> this<br> is<br> prone to errors.<br></blockquote> <br> <a href="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/t">https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/t</a><br> ree/<br> lib/ refcount.c?h=v4.17#n208<br></blockquote> <br> This is very new.<br></blockquote> <br> In 2009, there were already atomic_dec_and_test(), with the same<br> behavior:<br> <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree<br> /inc lude/asm-generic/atomic.h?h=v2.6.31#n123><br></blockquote> <br> So what?<br></blockquote> <br> So Linux have, at least since 2009, a function very similar to the<br> vlc_atomic_rc_dec() I propose, with the same behavior, and used in the<br> very same way. Here are random examples in 2009 (there are many others):<br> <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/inc<br> lude/net/ax25.h?h=v2.6.31#n171><br> <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/in<br> clude/net/netlabel.h?h=v2.6.31#n252><br> This contrasts with:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;"> the boolean evaluation of the return value is the opposite of what<br> any other ref counting API does (other than VLC's). Usually, zero is<br> for last reference and non-zero for non-last references.<br></blockquote></blockquote> <br> Not really. Using a boolean is confusing because different APIs have it <br> different ways. By comparison, it is utterly obvious what atomic_fetch_OP <br> (value before op) or atomic_OP_return (value after op).<br></blockquote><br>I really don't see how a boolean is confusing. We are following the same return value from the kernel, and if you have a doubt, just check the comment.<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> <br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> and:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;"> This is very new.<br></blockquote></blockquote> <br> Absolutely not. The refcount API in kernel is much newer than 2009. In fact, <br> it is so new that it is not even in AOSP yet. And it is largelly by security <br> people trying to remove a class of security issues that is only relevant to <br> the kernel.<br></blockquote><br>Kernel AOSP is always late, I don't understand this argument.<br><br>This set is OK to me but I would split the API from the usage.<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> <br> -- <br> レミ・デニ-クールモン<br> <a href="http://www.remlab.net/">http://www.remlab.net/</a><br> <br> <br> <br><hr><br> vlc-devel mailing list<br> To unsubscribe or modify your subscription options:<br> <a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></blockquote><hr><br>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>
-- <br>
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>