D as a Better C

via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Wed Aug 23 09:28:25 PDT 2017


On Wednesday, 23 August 2017 at 16:17:57 UTC, SrMordred wrote:
> On Wednesday, 23 August 2017 at 15:53:11 UTC, Walter Bright 
> wrote:
>> On 8/23/2017 7:10 AM, Steven Schveighoffer wrote:
>>> It's only if you do something that needs the runtime, such as 
>>> static ctors, or use the GC.
>>
>> Or use asserts, or even declare a struct.
>
> No structs in -betterC ???

IIUC, Steven's question was about the need for the `-betterC` 
switch - in his small example there was no need for it. Walter 
pointed out that without -betterC using structs cause link-time 
references to druntime, which are avoided by the use of the 
`-betterC` switch.
Though, one particular thing that doesn't work in `-betterC` 
w.r.t. structs is RAII. You can still call manually the 
destructor, but that's a crude hack. Work on RAII for `-betterC` 
is work in progress.


More information about the Digitalmars-d-announce mailing list