This is C++11'sattribute specifier sequence( http://en.cppreference.com/w/... )
About [[noreturn]], the official explanation is
Indicates that the function does not return. This attribute applies to function declarations only. The behavior is undefined if the function with this attribute actually returns.
The specifier is used for 指示函数永不返回. helps the compiler to perform 编译优化 (such as tail recursion, etc.). can also be used for 抑制编译器给出不必要的警告 (such as int f(); f();, without adding [[noreturn]], the compiler will warn that the return value of f() is ignored)
However, if the function does have a return value and you specify [[noreturn]], this is undefined behavior
This is
C++11
'sattribute specifier sequence
( http://en.cppreference.com/w/... )About
[[noreturn]]
, the official explanation isThe
specifier
is used for指示函数永不返回
.helps the compiler to perform
编译优化
(such as tail recursion, etc.).can also be used for
抑制编译器给出不必要的警告
(such asint f(); f();
, without adding[[noreturn]]
, the compiler will warn that the return value off()
is ignored)However, if the function does have a return value and you specify
[[noreturn]]
, this is undefined behavior