cast (char *) to (int *) ?

roger.h.levy rl at cbnewsl.att.com
Wed Aug 8 04:33:02 AEST 1990


We have a substantial amount of C code originally targeted to a 68008
system and now being ported to a 68000 system.  In the past, we have
casted character pointers to integer pointers in some situations and
then dereferenced the pointer.  Although this works OK with a 68008,
it will result in a bus error on our 68000 target if the address of
the data is odd.  Since we need to correct our code, I was wondering
whether a tool exists that can identify instances of such statements.
BTW, I checked my K&R and noted the warning about possible addressing
errors as a result of this practice.  We realize the error of our
ways so no further scolding is necessary.

Roger Levy
...!rl at groucho.ATT.COM



More information about the Comp.lang.c mailing list