It doesn't mean that the function doesn't return a value - it means that the function doesn't return at all. Calling the function gives a one way trip.
There's some limited use of this in hardware-related programming, where you don't want any function call overhead to be generated on the caller-side stack, since you aren't going to return there anyway.
For example when calling void main (void)
from the CRT start-up code inside a microcontroller embedded system - these are systems which keep running until you plug the power and they will never return from main()
. So if the compiler for such a system supports _Noreturn void main (void)
, then that creates less wasted stack space. Otherwise the CRT will just push x bytes on the stack which will remain there forever, as dead space.
It might also be useful for diagnostic purposes, such as when examining the behavior of compilers. As was done here, when demonstrating some major bugs in the clang compiler.