Keith Thompson <kst-> writes:
> "Bill Cunningham" <> writes:
>> What does this new noreturn specifer do? Is it related to return?
>
> Did you read something that mentions the "noreturn" specifier without
> explaining what it means?
>
> If so, the latest C11 draft is at
> http://www.open-std.org/jtc1/sc22/wg...docs/n1570.pdf
>
> If not, just keep reading.
One possible source of confusion: the standard says:
A function declared with a _Noreturn function specifier shall not
return to its caller.
Since the "shall" is not in a constraint, that means that if such a
function *does* return to its caller, the behavior is undefined.
No-return functions are typically declared as returning void, but that's
not required. It could make sense to have a non-void no-return function
if it's one of several functions that need to have the same type (say,
if they're called via a function pointer). I expect that would be an
unusual situation, though.
--
Keith Thompson (The_Other_Keith)
kst- <http://www.ghoti.net/~kst>
Will write code for food.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"