[FFmpeg-devel] [PATCH 1/7] opt: Remove dead code
Reimar.Doeffinger at gmx.de
Fri Feb 6 19:26:58 CET 2015
On Fri, Feb 06, 2015 at 04:07:36PM +0000, Timothy Gu wrote:
> On Fri Feb 06 2015 at 1:28:09 AM Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> > Timothy Gu <timothygu99 <at> gmail.com> writes:
> > > if (!i || !*val)
> > > return 0;
> > > }
> > > -
> > > - return 0;
> > > }
> > I fear that some (broken) compilers will emit
> > a warning when this gets applied that we
> > request to be interpreted as an error.
> > Same for 3, 4 and 5.
> Do you want to remove some warnings from some good compilers, or from some
> dumb compilers? I'd go with the first.
Well, personally I don't like it when functions
returning a value don't end with a return statement.
Plus no matter how clever the compiler there's always
going to be cases where it can't figure out that
the end of the function is unreachable.
In most cases it's also possible to reasonably
avoid warnings with both.
In the above case I guess you could replace
the return 0 in the if by a break instead.
In some cases risking a warning might be
better than contorting the code...
More information about the ffmpeg-devel