[003 Basic knowledge] Infinite loop C language writing in embedded systems

Generally for(;;){} has better performance

for(;;){}

These two ; ; empty statements, the compiler will generally optimize them out, and directly enter an infinite loop.

while(1){}

Every time in the loop, it is necessary to judge whether the constant 1 is equal to zero. Here, while does more than for, but from the perspective of assembly, it is the same code.

Guess you like

Origin blog.csdn.net/qq_41709234/article/details/131189308