I have a quick question about the g++ compiler. Or maybe it will end up being an architectural difference, but I have code that reads an odd multi-byte address, ie the following
char *a = 17;
int *b=(int *)a;
cout <<*b;
Now on a linux system this will work just fine (haven't tried with constant values but it works with dynamic values) on a x86 and darwin platform, but on a sparc platform I get a bus error. It has to do with the odd aligned addess. So my question is, is this a compiler issue or a platform issue?
An errata:
I successfully read the 4 bytes of the int seperately on the sparc, so it's definitely an odd aligned problem.
Thanks for looking.
char *a = 17;
int *b=(int *)a;
cout <<*b;
Now on a linux system this will work just fine (haven't tried with constant values but it works with dynamic values) on a x86 and darwin platform, but on a sparc platform I get a bus error. It has to do with the odd aligned addess. So my question is, is this a compiler issue or a platform issue?
An errata:
I successfully read the 4 bytes of the int seperately on the sparc, so it's definitely an odd aligned problem.
Thanks for looking.