[Issue 22831] No error for malformed extern(C) main function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 3 11:17:40 UTC 2022


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

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

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

--- Comment #2 from Dlang Bot <dlang-bot at dlang.rocks> ---
@MoonlightSentinel created dlang/dmd pull request #13749 "Fix 22831 - Check
signature of extern(C) main functions" fixing this issue:

- Fix 22831 - Check signature of extern(C) main functions

  Enforce that the `main` function uses (most likely) valid arguments /
  return types. The spec / C standard denotes the following signatures:

  ```d
  int main() { ... }
  int main(int, char**) { ... }
  ```

  The implemented checks are more lenient to accomodate for common
  deviations from the standards. See the DDOC comment of `checkMain()`
  for a list of accepted extensions.

  Exotic platforms that expect a different signature can circumvent the
  checks using  `pragma(mangle, "main")`.

  See e.g.
https://stackoverflow.com/questions/2108192/what-are-the-valid-signatures-for-cs-main-function

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

--


More information about the Digitalmars-d-bugs mailing list