[Ffmpeg-devel] compiler warnings

Rich Felker dalias
Wed Mar 29 22:30:16 CEST 2006


On Wed, Mar 29, 2006 at 11:26:47AM +0000, Dieter wrote:
> > don't be afraid of warnings.
> 
> Fixing compiler warnings is good engineering practice.

No, it's not. What if I made a compiler that prints a warning whenever
getpwuid(getuid())->pw_gecos contains "Dieter"? :)

The point being: some compiler warnings are valid, others are idiotic.
Warnings can be broken down into:

- cases where someone who does not know C might infer the wrong
  behavior from reading the code (like if (a=b)...).

- cases where there is no legitimate purpose for the code (things like
  if ((unsigned)x >= 0) or printf("%s", i)...)

- other cases i dont care to write about.

The second class should obviously be fixed. On the other hand fixing
the first just makes your code less readable by bloating it with
unnecessary parentheses and such. C has operator precedence, ==/=
distinction, etc. for a reason.

As for the specific case in your email, implicit casts between
compatible types should never be a warning.

Rich






More information about the ffmpeg-devel mailing list