[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] PML trouble with -m68020-60



Hi,

On torstai 13 tammikuu 2011, Vincent Rivière wrote:
> Eero Tamminen wrote:
> > And why one wouldn't be using "-Wmissing-prototypes
> > -Wstrict-prototypes" in C code when using GCC? :-)
> 
> I have checked, the problem exists.
> If someone calls a function returning a double without having provided a
> prototype, the result is considered as int then casted to double.
> The result is totally wrong, and by default GCC issues no warning :-(
> 
> > -Wmissing-prototypes
> 
> Useless.
> This warns the author of a function if he forgot to provide a prototype
> in its .h, but does nothing if the user forgets to include the .h.

Err?  If you don't include correct header, prototype is missing so you do
get a warning.

(I assume no sane coder declares global functions in .c file.)


> > -Wstrict-prototypes
> 
> Useless.
> This warns the author of a function if he has provided an old-school
> prototype, without arguments. No effect on the user.

Err???  Why you wouldn't want to check for correct arguments?

For example C++ coders often fall to this as in C++ "()" equals to "(void)"
(fully qualified prototype) but in C "()" equals to K&R prototype meaning
"(int)".


> Please test your tips.

I have, have you? :-)


> However:
> -Wimplicit-function-declaration warns the user if he forgot the include
> file.

No, this just tells if there's no declaration before function use.

It doesn't warn if it's e.g. a K&R one i.e. missing correct return type
and arguments.


> If there is no warning, he can be sure he will not have trouble
> because of functions returning doubles.
> -Wall would be usually better, as it includes this warning and many
> others.

One of course needs to use -Wall, that's obvious.  However,
it's insufficient to catch all mismatches.


	- Eero