P
parag_paul
hi All,
I happen to have a strccuture which has members in such adn such
location from the starting byte
struct A{
int i1,i2,i3;
char a;
char b;
int i4,i5;
}
Now I am dumping inofrmaiton in a file and want to recreate one
strucutre instance from the information above,
In the code, I do some thing like this
int k = (address of A ) + 14 ;
where I believe that I ma breaking the word boundary constraint.
Though IA32 is relaxed about the above scenario , I do see that there
is a crash with Sparc. ( I am using solaris SunOS59 , sparc64 ) .
Now the problem happens when I do something like
int * j = *(int*) ((address of A ) + 14 )
int * k = *(int*)((address of A ) + 18 )
but the Sparc does not complain when I use memcp and memcpy from the
bytes 14 or 18 etc.
Some thing like
memcp ( addressof A + 18, address of A + 14 , 4 )
Is that because the internal implementation of memcmp does a character
by character pick and compare, which does not lead to anykind of
corruption.
I happen to have a strccuture which has members in such adn such
location from the starting byte
struct A{
int i1,i2,i3;
char a;
char b;
int i4,i5;
}
Now I am dumping inofrmaiton in a file and want to recreate one
strucutre instance from the information above,
In the code, I do some thing like this
int k = (address of A ) + 14 ;
where I believe that I ma breaking the word boundary constraint.
Though IA32 is relaxed about the above scenario , I do see that there
is a crash with Sparc. ( I am using solaris SunOS59 , sparc64 ) .
Now the problem happens when I do something like
int * j = *(int*) ((address of A ) + 14 )
int * k = *(int*)((address of A ) + 18 )
but the Sparc does not complain when I use memcp and memcpy from the
bytes 14 or 18 etc.
Some thing like
memcp ( addressof A + 18, address of A + 14 , 4 )
Is that because the internal implementation of memcmp does a character
by character pick and compare, which does not lead to anykind of
corruption.