[FFmpeg-devel] [PATCH] added expr evaluation to drawtext - fontsize

Nicolas George george at nsup.org
Fri Sep 2 16:13:47 EEST 2016


Le septidi 17 fructidor, an CCXXIV, Moritz Barsnick a écrit :
> *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,

Ah. Parentheses over the whole expression are always optional, but in this
particular case, there is a good reason:

<stdin>:4:1: warning: suggest parentheses around assignment used as truth value [-Wparentheses]

Forgetting to double the equal in a comparison is a common mistake,
compilers detect it. But then you need a way of stating when it is
intentional.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160902/384cc272/attachment.sig>


More information about the ffmpeg-devel mailing list