don't know this compiler but I've seen this warning produced by gcc.
If the platform you're porting to does not like unaligned memory accesses (eg, ARM7), then these warnings are worth analyzing. They can point to some dirty tricks like:
static uint_8 foo[4];
{ // reading 4 bytes into a 32bit variable uint_32 bar = *((uint_32 *)foo); }
While this trick works perfectly on some platforms, it fails on ARM7 if foo[4] is not word-aligned (where word is 32 bits).
On the other hand, the warning doesn't necessarily indicate a problem, each warning has to be analyzed individually.
Not sure I understand this. The warning is there to tell you that you're casting from one type to another and this 'another' type is larger in size, which might imply a certain alignment requirement for it. It is then your responsibility as a developer to ensure that the variable is properly aligned for such a cast or that there are no alignment restrictions on the given platform or get rid of this cast and do things in a different way.
The usual advice. Don't do it. Cast are indications of bad code. 1) Casting (sometype *) to (othertype *) is especially evil. Get rid of the casts at the original platform. Retest. Then port.
1) Not always. The casts required by incompetent managers to suppress Sensible Warnings are indicative of incompetent managers. The resulting bad code then is more of a symptom.
--
--
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- like all pyramid schemes -- ultimately falters.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.