[Ffmpeg-devel] meta-discussion Re: [PATCH] part 8 - portability fixes (ILP32 vs LP64)

Måns Rullgård mru
Mon Jan 30 20:47:25 CET 2006

Rich Felker <dalias at aerifal.cx> writes:

> On Mon, Jan 30, 2006 at 06:11:52PM -0000, M?ns Rullg?rd wrote:
>> > Therefore I turn on the prototype/decl related warnings.
>> >
>> > I view the resulting warnings, and their fixes, as being
>> > related to portability between CPU architectures.  You are
>> > of course welcome to view them differently, but I cannot
>> > read your mind.
>> If you turn up the warning levels to for whatever reason, that does not
>> make all warnings generated related to that reason.  Specifically, warnings
>> about missing prototypes never have anything to do with machine word size.
> Actually they do, but not in Dieter's nonsense case where the
> functions are defined prior to their use. Consider something like:
> int foo(char *);
> If I'm missing this prototype and call it with foo(0) on a system
> where sizeof(char *) > sizeof(int), bad things will happen.

I am well aware of that, and I made the distinction in the part you
didn't quote.

> Even if I explicitly use foo((char *)0), it may not work, since
> functions without prototypes are considered equivalent to 'old style'
> functions (like those with variable # of arguments) and may need to
> use a different calling convention (arguments on stack instead of in
> registers) on architectures with register-passing and such.
> So in summary, lack of declaration before using a function _is_ a
> portability problem, but the function declaration doubles as a
> definition, obviously.

ITYM the definition doubles as declaration.

Implicit declaration of functions is not just a portability problem.
It is also bad style since it can potentially hide serious bugs.

On the whole though, I agree with you this time.

M?ns Rullg?rd
mru at inprovide.com

More information about the ffmpeg-devel mailing list