On Sun, Mar 21, 2010 at 06:23:43PM +0100, Stefan Reinauer wrote:
On 3/21/10 5:38 PM, Kevin O'Connor wrote:
Otherwise, the compiler didn't stop the cast - it's just generating a warning that it's dangerous. (That is, it's letting the user know that any memory accesses via the "unsigned char *" reference wont necessarily be seen from the "struct acpi_hdr *" reference and vice-versa.)
So making both (or even one of them) const should help?
I don't know. It's probably worth testing. A const pointer doesn't mean the memory can't change - it just means the memory can't be changed via that pointer - so, gcc might still warn.
To be honest, I just turned off the warning in SeaBIOS (-Wno-strict-aliasing). Last time I looked, different versions of the compiler had different heuristics for warning, and I couldn't see anything that I was doing that was wrong. So, I'm probably not the best person to ask on how to prevent the warnings. :-)
-Kevin