c - avr-gcc never returning main optimalization -


somewhere read if never return main() loop, can spare ~66 bytes compiler switch in avr-gcc, couldn't find site anymore.

this embedded:

main() {  while(1)  {    // stuff  } } 

for gcc can use special attribute indicate function not return:

int main() __attribute__ ((noreturn)) {     (;;) {          // stuff     }     __builtin_unreachable (); } 

optionally can add __builtin_unreachable (); indicate part of code can never reached.

although in cases recognised optimisation flags, without such while(1) can generate more code for(;;).


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -