I\'m trying to compile some c code with g++ (yes, on purpose). I\'m getting errors like (for example):
error: invalid conversion from \'void*\' to \'unsigned cha
How do I disable warnings (globaly) for conversions from void* to other pointer types?
Well it might require direct interaction with compiler's code. This is probably not what you want. You want to fix your code. First, these are not warnings but errors. You need to cast void*
as you can not convert a void*
to anything without casting it first (it is possible in C however which is less type safe as C++ is).
For example you would need to do
void* buffer = operator new(100);
unsigned char* etherhead = static_cast(buffer);
^
cast
If you want a dynamically allocated buffer of 100 unsigned char
then you are better off doing this
unsigned char* p = new unsigned char[100];
and avoiding the cast.
void pointers