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
changed.

"George" <George@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0D4718E0-5DCB-4762-8D0D-B74BD1442FAF@xxxxxxxxxxxxxxxx
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
the
conclusion.

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


regards and have a nice day,
George



.



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 same...so you said that the assembly code generated ...
    (microsoft.public.windowsce.platbuilder)
  • 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. ...
    (comp.arch.embedded)
  • 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, ...
    (comp.lang.fortran)
  • Re: Assembly code with Borlands C compiler
    ... Assembly code with Borland's C compiler ... Function should return a value in function pooi ...
    (comp.arch.embedded)
  • Re: Assembly code with Borlands C compiler
    ... Assembly code with Borland's C compiler ... The segment names are a guess for the most part - taken from masm6's ... Function should return a value in function pooi ...
    (comp.arch.embedded)