c - Variable accessed for Read point on same line , will OS read the memory twice? -


please me understand how compiler/os responds following program line in c,

int c;  void task1() { c+=c;  // line c=c+c; 2 read point 1 write } 

will memory read twice or single time ?

that depends on processor, compiler, , compiler options. on processor that has multiply memory instruction , compiler not in debug mode might code generated like

mull2 #2, c 

the memory read once , written once. on processor operations in registers, might like:

movl c, r3 mull #2, r3 movl r3, c 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -