Are all functions in C/C++ assumed to return?

后端 未结 7 1554
抹茶落季
抹茶落季 2020-12-31 01:49

I was reading this paper on undefined behaviour and one of the example \"optimisations\" looks highly dubious:

if (arg2 == 0)
    ereport(ERROR,         


        
7条回答
  •  没有蜡笔的小新
    2020-12-31 02:23

    Most functions are assumed to eventually return. There are compiler-specific extensions in some compilers to inform the compiler that a function will never return.

    __attribute__ ((noreturn)) does this for gcc.

提交回复
热议问题