[vlc-devel] [vlc-commits] mjpeg: Yoda code usage avoiding you will
hugo at beauzee.fr
Mon Sep 24 22:45:30 CEST 2012
On Mon, Sep 24, 2012 at 11:26 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le vendredi 21 septembre 2012 18:23:47, Hugo Beauzée-Luyssen a écrit :
>> vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Fri Sep
>> 21 17:16:00 2012 +0300| [efd7d3f6518c3917231618e72f131cfa78f3fa48] |
>> committer: Hugo Beauzée-Luyssen
>> mjpeg: Yoda code usage avoiding you will
> I don't follow that practice myself. But I can see the point and I don't think
> it deserves being ridiculed. It has one big advantage. If there is a single
> equal sign, the compiler will bark on "if (0 = x)", instead of emitting a
> warning and unintended code on "if (x = 0)".
> Rémi Denis-Courmont
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
I agree that it has this advantage.
To the question «Is it worth asking "is blue the sky" instead of "Is
the sky blue"» for that one specific thing, I'd tend to answer no, but
I guess it's a bit out of scope.
Also, I don't ridicule that practice, it just that yoda code was used
in a small number of spots, wheras "regular" comparisons were used
If a file coding style uses yoda code in a consistant manner well so
be it! Here the message could have been "Try to use a consistant
comparaison scheme", but it just felt funnyer that way to me.
mail: hugo at beauzee.fr
More information about the vlc-devel