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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 7 18:36:14 UTC 2021


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #3 from Dlang Bot <dlang-bot at dlang.rocks> ---
@MoonlightSentinel created dlang/dmd pull request #13138 "Fix 22113 - Allow
`noreturn` as a type for main function" fixing this issue:

- 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