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

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

collision detection - C++ library for mesh to mesh intersection: what is available? -

python - Django-easy-pdf: xhtml2pdf reporting reportlab 2.2+ is required, but 3.0 installed -