Re: MSDN volatile sample

Because Sleep() is an imported (from system DLL) function, the compiler
cannot make any assumption about whether a global variable will keep its
state across the call. Thus it won't assume that the variable won't be

"George" <George@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
Hi Alexander,

I throught it is not the 1st time you mentioned Sleep(0) will prevent
compiler to optimize the code. :-)

Do you have any in-depth analysis about how Sleep(0)'s internal mechanism
prevents compiler to optimize read operation? I think some people will be
interested if you could provide some internal perpective analysis beyond

Maybe the straight forward way is to post some assembly code. :-)

regards and have a nice day,


Relevant Pages

  • Re: Datatype misalignment exception....
    ... the compiler generates 4 access in memory that read one byte ... and r3) so the access doesn't rise exception because it is byte aligned. ... Bruce.Eitman AT Eurotech DOT com ... the BYTE array is the you said that the assembly code generated ...
  • Re: What micros do you actually like to work with?
    ... I really like ARM chips. ... I also like the 68K architecture which IMHO ... The MSP430 on the other hand has a GNU compiler collection compiler ... makes for easy and readable assembly code. ...
  • Re: Poor performance of implied-DO loop with Intel Fortran
    ... Obviously v8.0 of the Intel compiler scales fine, ... makes me think I will continue to use this idiom with an eye to any ... > way to fill large arrays. ... > the generated assembly code, ...
  • Re: Assembly code with Borlands C compiler
    ... Assembly code with Borland's C compiler ... Function should return a value in function pooi ...
  • Re: Assembling Visual Studio generated listing files
    ... assembly code) internally. ... the Bliss-11 compiler we did at CMU (because there were so many PDP-11 object ... on all machines) and the original PDP-11 C compiler from Bell Labs. ... Not just a little bit stupid; ...