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

Attachment: signature.asc
Description: Digital signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to