Comments (3)
  • Add a Comment
  • Edit
  • More Actions v
  • Quarantine this Entry

1 PeeterJoot commented Permalink

are these 6 functions truely the only functions that are allowed? Something like: <div>&nbsp;</div> void sleepForever() <br /> { <br /> for ( ; ; ) sleep( 10000 ) ; <br /> } <div>&nbsp;</div> also never returns. Are other functions that are also marked _NoReturn also allowed?

2 RoyHu commented Permalink

Peeter, <div>&nbsp;</div> Thank you for posting this comment. I will discuss this with the developer of this feature, and get back to you soon.

3 RajanB commented Permalink

You can add the _Noreturn function specifier to *any* function. The compiler can perform optimizations assuming that function will never return even if it does not call one of the functions given in the list. The list is likely just for the common use cases, though like the example you gave, there could be other functions that do not return that do not call any of those six functions. <br /> By the way, If you want to know more about C11 and what the compiler supports, you can see the developerWorks article at http://www.ibm.com/developerworks/rational/library/support-iso-c11/