[Issue 22113] Allow `noreturn` as a type for main function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 8 06:11:50 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=22113

Dlang Bot <dlang-bot at dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Dlang Bot <dlang-bot at dlang.rocks> ---
dlang/dmd pull request #13138 "Fix 22113 - Allow `noreturn` as a type for main
function" was merged into master:

- 3bd54c000197c5d50809d8a6269c84aa2612e08b by MoonlightSentinel:
  Fix 22113 - Allow `noreturn` as a type for main function

  `noreturn` is a valid because it's a subtype of `int`/`void` and also
  guarantees that the function will never actually return to the caller.

  The motivation as stated on bugzilla:

  >> What advantage can one derive from it over `void` ?
  >
  > Smaller codegen, statically knowing the endless loop doesn't have any
  > breaks. Could be useful for embedded applications that are supposed to
  > run forever until the power is cut off.

https://github.com/dlang/dmd/pull/13138

--


More information about the Digitalmars-d-bugs mailing list