On Mar 27, 2013, at 11:27 AM, Nicholas Leippe <[email protected]> wrote:
>> - Barring a compiler bug, CPU malfunction or memory corruption is the
>> following possible, in which language, and how? You have the code that
>> says:
>>
>> s.a = 43;
>> printf("s.a=%u\n",s.a);
>>
>> Those lines result in the following message:
>>
>> s.a=11
>
> There are likely other possibilities, but some that comes to mind are:
> 1) this could be a threaded process in C/C++ missing a lock around
> these two lines--another thread changed it between them.
> 2) this could be C++ where s.a is an instance of a class that
> overloads operator= to do something non-obvious
> 3) s.a represents a memory-mapped IO location--reads and writes may
> mean very different things
4) This is a five-bit field in C:
struct mystruct {
unsigned int a:5;
} s;
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/