Memory safe in D

bachmeier no at spam.net
Tue Apr 16 15:51:11 UTC 2024


On Tuesday, 16 April 2024 at 15:48:15 UTC, bachmeier wrote:
> On Tuesday, 16 April 2024 at 07:25:21 UTC, ShowMeTheWay wrote:
>
>> This below is valid C++ code, a bug in C#, but valid code in D 
>> (even though it's actually a bug):
>>
>> A a;
>> a.run();
>>
>> This should not be legal D code. It should produce an error if 
>> compiled.
>>
>> It's not difficult for a compiler to work this one out.
>
> I'm repeating myself, but there's no good argument in favor of 
> that compiling. All it gives you is bugs, confusion, and a 
> steep learning curve in the name of saving a few keystrokes.

That should say there's no good argument in favor of the first 
line in your example compiling. The compiler should stop as soon 
as it sees `A a;`.


More information about the Digitalmars-d mailing list