Bug 18273 – Better C: wrong exit code from main()

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-01-20T13:40:20Z
Last change time
2018-02-09T10:24:30Z
Keywords
betterC
Assigned to
No Owner
Creator
mfx

Comments

Comment #0 by markus — 2018-01-20T13:40:20Z
I've stumbled about this while trying Better C from https://dlang.org/spec/betterc.html extern(C) void main() { import core.stdc.stdio : printf; printf("Hello betterC\n"); // BUG: the exit code of this program is wrong (usually not 0) } Possible solutions: 1) the compiler should add an implicit "return 0" for "void main()"; or 2) require that main() returns "int" in extern C/C++ mode
Comment #1 by bugzilla — 2018-02-08T10:08:46Z
Comment #2 by github-bugzilla — 2018-02-09T10:24:29Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/dd3d5f827368479b7ed7da416471462bd377b0b8 fix Issue 18273 - Better C: wrong exit code from main() https://github.com/dlang/dmd/commit/19397e9607e82f63c28592db75dfe28de19731f9 Merge pull request #7851 from WalterBright/fix18273 fix Issue 18273 - Better C: wrong exit code from main() merged-on-behalf-of: Walter Bright <[email protected]>