GCC-4.0 warnings

Roland Illig roland.illig at gmx.de
Mon May 23 10:22:03 UTC 2005


Pavel Roskin wrote:
> While the code is correct, it's not obvious for gcc.  The "knee-jerk"
> reaction could be to initialize val in caller(), but sometimes it may be
> better to fix callee(), especially if it's used many times.  Even more
> so if it's not documented that the pointer won't be initialized if
> callee() returns a failure code.

Hmm, my opinion is that a function should not change any of their output 
parameters on failure, but I see the problem for the compiler. Probably 
I will initialize the output parameters even on failure.

> I have fixed all warnings in HEAD except one introduced by you.  I guess
> you can fix it better (I tried and it's not trivial, so you may want to
> reverse some of your changes instead):
> 
> help.c: In function 'help_handle_key':
> help.c:627: warning: passing argument 3 of 'check_movement_keys'
> discards qualifiers from pointer target type

I have fixed this. The code had been really ugly. It was not necessary 
to pass currentpoint to the check_movement_function(), as it is a global 
variable.

Roland



More information about the mc-devel mailing list