Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/13/17 17:59
Read: times


 
#190777 - two problems
Responding to: ???'s previous message
Balasubramanian Vaidhyana said:
int index;

for (index=0;index<10000000L;index++)
{
}


This code has two problems:
1) 10000000L does not fit in an int and thus index will overflow earlier and the comparison is always true.
2) A C compiler is allowed to remove any code that has no side effects and thus this loop could be optimized out.

List of 7 messages in thread
TopicAuthorDate
GPIO pin toggle on TUSB3410            01/01/70 00:00      
   Short Pulse            01/01/70 00:00      
      GPIO working            01/01/70 00:00      
         Was it?            01/01/70 00:00      
            GPIO toggle            01/01/70 00:00      
               Good to hear            01/01/70 00:00      
                  two problems            01/01/70 00:00      

Back to Subject List