D as a Better C

jmh530 via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Wed Aug 23 11:31:57 PDT 2017


On Wednesday, 23 August 2017 at 17:39:00 UTC, Walter Bright wrote:
> On 8/23/2017 10:26 AM, jmh530 wrote:
>> Am I correct that betterC requires main to be extern(C) and 
>> must act like a C main (i.e. no void return)?
>
> Yes.

This might be added to
http://dlang.org/dmd-windows.html#switch-betterC
or
http://dlang.org/spec/betterc.html

>
>> Is that something that can be changed in the future?
>
> Yes, but I don't see a need for it.

Fair enough. A version statement could handle it

version(BetterC)
{
     extern(C) int main()
     {
         callRealMain();
     }
}
else
{
     void main()
     {
         callRealMain();
     }
}



More information about the Digitalmars-d-announce mailing list