Hi, > TR0 = 0; // reset the timer > while( TR0 == 0 ); // wait for the flag to be set. > i++; // get out of the loop and increment > }
> What is SDCC going to do in this case. > Will it say that line corr. to "i++" as unreachable code. > But how does the compiler know that? > If TR0 is not marked as `volatile' and does not refer to an SFR, SDCC will believe that TR0 cannot be modified behind its back and thus assume the loop to never be left: TR0 is 0 on entry to the loop, not changed within, thus TR0 stays 0 forever. Hope that helped, Raphael ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user