Questions tagged «noreturn»

5
什么是不归路?
[dcl.attr.noreturn]提供以下示例: [[ noreturn ]] void f() { throw "error"; // OK } 但我不明白这是什么意思[[noreturn]],因为该函数的返回类型已经存在void。 那么,该noreturn属性的意义是什么?应该如何使用?

9
为什么“不归还”功能归还?
我读 这个问题关于noreturn属性,它被用于那些不返回到调用函数。 然后我用C编写了一个程序。 #include <stdio.h> #include <stdnoreturn.h> noreturn void func() { printf("noreturn func\n"); } int main() { func(); } 并使用此生成的代码汇编: .LC0: .string "func" func: pushq %rbp movq %rsp, %rbp movl $.LC0, %edi call puts nop popq %rbp ret // ==> Here function return value. main: pushq %rbp movq %rsp, %rbp …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.