What does “sibling calls” mean?

后端 未结 3 1626
独厮守ぢ
独厮守ぢ 2021-02-05 04:49

On GCC manual,

-foptimize-sibling-calls

Optimize sibling and tail recursive calls.

I kn

3条回答
  •  忘了有多久
    2021-02-05 05:24

    It must be something like this:

    int ispair(int n) { return n == 0 ? 1 : isodd(n-1); }
    int isodd(int n) { return n == 0 ? 0 : ispair(n-1); }
    

    In general, if the function call is the last sentence, then it can be replaced by a jump.

    void x() { ......; y(); }
    

    In this case y() can be replaced by a jump (or an inline function) instead of using a standard function call.

提交回复
热议问题