Why does “noreturn” function return?

前端 未结 9 1594
执念已碎
执念已碎 2020-12-25 10:51

I read this question about noreturn attribute, which is used for functions that don\'t return to the caller.

Then I have made a program in C.

         


        
9条回答
  •  旧时难觅i
    2020-12-25 11:04

    no return function does not save the registers on the entry as it is not necessary. It makes the optimisations easier. Great for the scheduler routine for example.

    See the example here: https://godbolt.org/g/2N3THC and spot the difference

提交回复
热议问题