Crazy idea from a recruiter

John Nielsen lists at jnielsen.net
Wed Mar 27 13:35:53 MDT 2013


On Mar 27, 2013, at 11:27 AM, Nicholas Leippe <nick at leippe.com> 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;



More information about the PLUG mailing list