Friday, 15 May 2015

c - How does asm("nop"); works? -



c - How does asm("nop"); works? -

i reddish definition http://en.wikipedia.org/wiki/nop still need simpler definition.

i stumbled across code , don't know does:

switch (something) { case this_one: asm ("nop"); break; case other_one: asm ("nop"); break; default: asm ("nop"); break; }

nop assembly instruction nothing--well close nil can , still execute machine instruction, means (probably) tiny bit of time goes (which can have limited value in realtime applications.

in case, statement asm("nop"); makes no semantic difference program. reason can think might nowadays "force" compiler not collapse code paths, making machine construction of switch statement visible if @ object code or disassemble machine code or view in debugger.

c assembly

No comments:

Post a Comment