[FFmpeg-devel] [RFC] Scalar color conversion utils (colorutils.[hc])?

Reimar Döffinger Reimar.Doeffinger
Mon May 4 12:25:25 CEST 2009


On Mon, May 04, 2009 at 09:28:28AM +0200, Stefano Sabatini wrote:
> On date Monday 2009-05-04 07:56:34 +0200, Diego Biurrun encoded:
> > On Mon, May 04, 2009 at 01:08:33AM +0200, Stefano Sabatini wrote:
> > > --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> > > +++ libavfilter-soc/ffmpeg/libavfilter/colorutils.c	2009-05-04 01:04:50.000000000 +0200
> > > @@ -0,0 +1,246 @@
> > > +
> > > +int main()
> > 
> > Once more with feeling:
> > 
> >   int main(void)
> > 
> > You cannot leave this out, it's not just consistency pedantry.
> 
> Sorry I'm used to write tons of such test programs, and I always
> leave out the void.
> 
> Can you say why it is better with void?

If you leave out void, in C99 there is no prototype for the function,
which can lead to unexpected behaviour if you ever call that function.
E.g.
int main() {
  return 0;
}

void test(void) {
  main("asd", 3, 5, 5.0);
}

will not even result in a warning.
Now if out of principle you never, ever, ever call main from anywhere
else it's probably not a real problem but it still remains a bad habit
IMO.



More information about the ffmpeg-devel mailing list