[Issue 18273] New: Better C: wrong exit code from main()

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jan 20 13:40:20 UTC 2018


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

          Issue ID: 18273
           Summary: Better C: wrong exit code from main()
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: markus at oberhumer.com

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

--


More information about the Digitalmars-d-bugs mailing list