> C can't cast from type A to type B. There is only the possibility to
> cast every shit to type B. And this is dangerous.
> So you write a
> 
>   int     ifreq;
>   double  dfreq;
>   ifreq = (int) ( dfreq );
> 
> and now dfreq changes the type to 'struct bla*'. 
> C converts this without batting an eyelid.

...but doing anything different from address arithmetic won't compile.
So if you do anything useful with dfreq, the compiler will catch the
error; if you don't do anything useful with it, then

a) you don't do _anything_ with it, so no worries, mate
or
b) it is only part of an API interface, so it's types should be well
   defined and documented.

The example of the X11 problem you give, is typical of X11, and not so
much of C typecasts, IMHO. The example X11 implementation is full of evil
ineteger <-> pointer conversions.

Ciao,

Segher

--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )

Reply via email to