Re: [FFmpeg-devel] [RFC]lavu/opt: Use && instead of * in boolean expression
On 5/4/2017 4:32 PM, Carl Eugen Hoyos wrote: > Hi! > > It may be better to disable the warning. > > Carl Eugen > > -num = den ? num * intnum / den : (num * intnum ? INFINITY : NAN); > +num = den ? num * intnum / den : (num && intnum ? INFINITY : NAN); In order to preserve the original logic, why not do the following: +num = den ? num * intnum / den : (((num * intnum) != 0) ? INFINITY : NAN); Aaron Levinson ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [RFC]lavu/opt: Use && instead of * in boolean expression
2017-05-05 3:12 GMT+02:00 Aaron Levinson : > On 5/4/2017 4:32 PM, Carl Eugen Hoyos wrote: >> Hi! >> >> It may be better to disable the warning. >> >> Carl Eugen >> >> -num = den ? num * intnum / den : (num * intnum ? INFINITY : NAN); >> +num = den ? num * intnum / den : (num && intnum ? INFINITY : NAN); > > In order to preserve the original logic, why not do the following: > > +num = den ? num * intnum / den : (((num * intnum) != 0) ? INFINITY : > NAN); Simpler patch attached. Carl Eugen From 65811b8d63aee1bb02dc3d379bfba74b72524e67 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 5 May 2017 09:24:28 +0200 Subject: [PATCH] configure: Silence a less useful warning. Silences the following warning: warning: '*' in boolean context, suggest '&&' instead [-Wint-in-bool-context] --- configure |1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 804b0ce..bb969f0 100755 --- a/configure +++ b/configure @@ -6116,6 +6116,7 @@ check_cflags -Wmissing-prototypes check_cflags -Wno-pointer-to-int-cast check_cflags -Wstrict-prototypes check_cflags -Wempty-body +check_cflags -Wno-int-in-bool-context if enabled extra_warnings; then check_cflags -Wcast-qual -- 1.7.10.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [RFC]lavu/opt: Use && instead of * in boolean expression
On Fri, May 05, 2017 at 09:26:05AM +0200, Carl Eugen Hoyos wrote: > 2017-05-05 3:12 GMT+02:00 Aaron Levinson : > > On 5/4/2017 4:32 PM, Carl Eugen Hoyos wrote: > >> Hi! > >> > >> It may be better to disable the warning. > >> > >> Carl Eugen > >> > >> -num = den ? num * intnum / den : (num * intnum ? INFINITY : NAN); > >> +num = den ? num * intnum / den : (num && intnum ? INFINITY : NAN); > > > > In order to preserve the original logic, why not do the following: > > > > +num = den ? num * intnum / den : (((num * intnum) != 0) ? INFINITY > > : NAN); > > Simpler patch attached. > > Carl Eugen > configure |1 + > 1 file changed, 1 insertion(+) > 06cf250153c05fb3392bd88c4a88f8fa056c26f2 > 0001-configure-Silence-a-less-useful-warning.patch > From 65811b8d63aee1bb02dc3d379bfba74b72524e67 Mon Sep 17 00:00:00 2001 > From: Carl Eugen Hoyos > Date: Fri, 5 May 2017 09:24:28 +0200 > Subject: [PATCH] configure: Silence a less useful warning. > > Silences the following warning: > warning: '*' in boolean context, suggest '&&' instead [-Wint-in-bool-context] > --- > configure |1 + > 1 file changed, 1 insertion(+) probably ok [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB it is not once nor twice but times without number that the same ideas make their appearance in the world. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [RFC]lavu/opt: Use && instead of * in boolean expression
On 05.05.2017 09:26, Carl Eugen Hoyos wrote: 2017-05-05 3:12 GMT+02:00 Aaron Levinson : On 5/4/2017 4:32 PM, Carl Eugen Hoyos wrote: Hi! It may be better to disable the warning. Carl Eugen -num = den ? num * intnum / den : (num * intnum ? INFINITY : NAN); +num = den ? num * intnum / den : (num && intnum ? INFINITY : NAN); In order to preserve the original logic, why not do the following: +num = den ? num * intnum / den : (((num * intnum) != 0) ? INFINITY : NAN); Simpler patch attached. The GCC warning is not that bad, IMHO both proposed code alternatives are more readable than the original line. Just my 2c. Tobias ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [RFC]lavu/opt: Use && instead of * in boolean expression
2017-05-05 1:32 GMT+02:00 Carl Eugen Hoyos : > Hi! > > It may be better to disable the warning. Ping, one of the two patches should be applied, we currently have one vote for each. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [RFC]lavu/opt: Use && instead of * in boolean expression
Hi, On Sat, Oct 7, 2017 at 7:14 PM, Carl Eugen Hoyos wrote: > 2017-05-05 1:32 GMT+02:00 Carl Eugen Hoyos : > > Hi! > > > > It may be better to disable the warning. > > Ping, one of the two patches should be applied, > we currently have one vote for each. > I'd go for && since it's boolean. No strong opinion though. Ronald ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [RFC]lavu/opt: Use && instead of * in boolean expression
2017-10-08 1:55 GMT+02:00 Ronald S. Bultje : > Hi, > > On Sat, Oct 7, 2017 at 7:14 PM, Carl Eugen Hoyos wrote: > >> 2017-05-05 1:32 GMT+02:00 Carl Eugen Hoyos : >> > Hi! >> > >> > It may be better to disable the warning. >> >> Ping, one of the two patches should be applied, >> we currently have one vote for each. >> > > I'd go for && since it's boolean. No strong opinion though. Patch applied. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel