Herbert Rosenau said:
Uh, you are one of the braindamaged peoples who are programming n
(int) i = (int) i + (int);
and so on?
The cast on the LHS is a contraint violation; the result of a cast
is not an lvalue. The (int) at the end is a syntax error; you have
a cast operator with no operand. If you're going to throw around
words like "braindamaged", you really should be more careful not
to make boneheaded mistakes yourself.
Either you are casts all and everything regardless of usefull or not
or you casts only things tha needs to be casted only because you must
explicity give hints to the compikler to get exactly what you means.
*Or* you don't mind using implicit conversions in some cases, but
prefer to cast explicitly in others. The C standard permits implicit
conversions to and from void* as a special case. Reasonable people
might happen to dislike this rule, and prefer to make the conversion
explicit.
I don't (I happen to think that this particular special-case rule
isn't a bad idea), but for example I dislike C99's special-case rule
that falling off the end of main() is equivalent to "return 0;",
so I write "return 0;" explicitly, even though it's not necessary.
I also put curly braces for single statements, even though, again,
it's not necessary.
Casting a the result of a function that returns a pointer to void is
errornous because this hinderas the compiler to tell you that you are
making errors or at least simple mistakes.
No, it is not erroneous, unless you're using some other meaning for
that word. I've explained this to you before.
Any cast is definitely a potential error of the programmer writing
that crap!
Most of any casts are superflous - no question! However when you means
you has to use a cat in 99.99% of all cases you'll find yourself lying
to the compiler because you are unable to understund what you're
doing.
There are reasons not to cast the result of malloc(), but they're more
subtle than you seem to realize.