I know reading and writing 32-bit integers while in 32-bit mode is safe because it can be done in a single clock (ignoring memory latency). I would assume this is not the case for 64-bit integers, since they don't fit in a single register, and I'm guessing the data bus is not wide enough either.
So, is reading and writing 64-bit integers (and all data types larger than 32 bits, for that matter) thread-safe in 32-bit mode?
How do you mean? Like |VA RI AB LE| and |00 00 VA RI||AB LE 00 00|?
Not necessarily. What about this?
1 2 3 4
struct A{
char a;
int b;
};
Although I can't remember ATM if the compiler adds padding between members or only at the end. I'm guessing at the end, otherwise it would be too wasteful.
thats what i was saying.. a class or a variable or struct will be aligned and mostly all the compilers do that.. so chances are that the operations will be atomic.. but only in case of 32/64 bit values as Helios said..
anyway.. there is nothing to discuss on this topic i think.. we all are saying the same thing differently.. :)