[Nut-upsdev] gcc4 compiler warnings

Niklas Edmundsson nikke at acc.umu.se
Fri Feb 10 14:40:02 UTC 2006


On Fri, 10 Feb 2006, Peter Selinger wrote:

>> I just realized the same. But there is a better way to make the compiler
>> shut up about these warnings, by defining these buffers as 'void *'
>> instead of 'char *' like:
<snip>

> I am against this. In principle, compiler warnings are a good thing
> (for example, try applying one of the above functions to (int *)).
>
> I believe the type (void *) should only be used for data whose value
> is intended to be typecast (such as malloc()), or where the nature of
> the data truly does not matter (such as memset()).

I agree completely on this. Using void * just to get rid of 
compiler warnings is the wrong way to go, it'll bite you in the long 
run.

/Nikke
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  Niklas Edmundsson, Admin @ {acc,hpc2n}.umu.se      |     nikke at acc.umu.se
---------------------------------------------------------------------------
  If little else, the brain is an educational toy.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



More information about the Nut-upsdev mailing list