[crossfire] Re: [Crossfire-cvs] CVS commit: crossfire

Andreas Kirschbaum kirschbaum at myrealbox.com
Tue Aug 16 04:57:24 CDT 2005


Nicolas Weeger wrote:
>
     
      > Since Ansi C does allow you to assign any pointer value to and from
     
     >
     
      > "void *" this type cast is not necessary. OTOH such a cast
     
     >
     
      > potentially hides future bugs because the compiler cannot anymore
     
     >
     
      > generate warnings for mismatched pointer
     
     >
     
     
     >
     
      Actually, there is a warning (under MS Visual Studio) since event and
     
     >
     
      options, const pointers, are treated like pointers.
     
     
I see. I missed that the source pointers were const.


>
     
      It is also a mistake for me to send as void* (as opposed to const
     
     >
     
      void*), since it's then easy to change the string in the plugin which
     
     >
     
      would lead to data corruption.
     
     
I agree. But wouldn't it be better to leave out the type casts and let
the compiler issue warnings? After all, (as you pointed out) it *is* a
problem, so suppressing the warning is not good.

>
     
      Note also that I added the specific conversion because (hopefully)
     
     >
     
      soon plugin system will be redone and those parameter passing calls
     
     >
     
      will be totally changed.
     
     
OK. Then it probably does not matter anymore if the type casts are there
or not. :)

    
    


More information about the crossfire mailing list