[FFmpeg-devel] [PATCH] added expr evaluation to drawtext - fontsize
Moritz Barsnick
barsnick at gmx.net
Fri Sep 2 16:06:57 EEST 2016
On Fri, Sep 02, 2016 at 14:20:37 +0200, Nicolas George wrote:
> You mean the parentheses? Well, if you are not sure, then the parentheses
> are necessary. We are not playing golf, we want code that is readable and
> robust.
>
> For reference, comparisons have precedence over assignments. That means
> "a = b < c" is equivalent to "a = (b < c)", not "(a = b) < c". Therefore,
> the parentheses are necessary even for golf.
No, I meant Brett's:
if ((ret = update_fontsize(ctx))) {
*Assuming* he means "assign update_fontsize()'s return value to ret,
and check whether ret is != 0", which would correspond to the more
verbose
if ((ret = update_fontsize(ctx)) != 0) {
is it sufficient to say:
if (ret = update_fontsize(ctx)) {
or is it required, or is it more readable or even desired by "style
guide" to say:
if ((ret = update_fontsize(ctx))) {
(to clarify it's a check of an assignment) - this is what Brett used,
or even
if ((ret = update_fontsize(ctx)) != 0) {
?
I'm very well aware that brackets are safer over guessing what operator
precedence is, even though ffmpeg code often prefers to leave away
unneeded brackets. In this particular case, Brett used no second
operator.
Moritz
More information about the ffmpeg-devel
mailing list