D as a Better C

jmh530 via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Wed Aug 23 10:26:39 PDT 2017


On Wednesday, 23 August 2017 at 14:01:30 UTC, jmh530 wrote:
>
> Great piece.
>
> It might be useful to beef up the documentation on some of the 
> things that betterC changes. For instance, here
> http://dlang.org/dmd-windows.html#switch-betterC
> links to TypeInfo, which has like one line of explanation of 
> what it's for, and ModuleInfo isn't linked to at all (and I'm 
> still a little unclear on what that does).


Am I correct that betterC requires main to be extern(C) and must 
act like a C main (i.e. no void return)?

Is that something that can be changed in the future? For 
instance, the simplest change would be if the compiler knows that 
its betterC, then it can insert extern(C) to main. A second 
adjustment could potentially to re-write D's void main's to int 
and add in a return. The first seems like a good idea 
superficially, but I'm not 100% on the second.


More information about the Digitalmars-d-announce mailing list