"crook" <ma*****@bsdmail.org> writes:
I have code below and it works properly but when I'm compiling it with
"--pedantic" flag, GCC(3.4.2) shows such warning: "ISO C forbids
casting nonscalar to the same type". How can I change this code to get
rid of this warning?
/*parameters is void* type*/
struct params p = ( struct params )*( ( struct params * )parameters );
The warning message is a bit misleading. ISO C doesn't just forbid
casting a nonscalar to the same type; it forbids casting a nonscalar
to or from *any* type. Both the operand of a cast operator, and the
type specified in the cast itself, must be of scalar type (either
arithmetic or pointer).
There's an exception to this, but it doesn't apply here. If the
target type is void, the operand can be of any type.
--
Keith Thompson (The_Other_Keith)
ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.