Maybe D is right about GC after all !

Walter Bright newshound2 at digitalmars.com
Tue Dec 26 04:47:35 UTC 2017


On 12/24/2017 7:00 AM, Dylan Graham wrote:
> I also recall someone saying that C++'s memory problem is fixed. D's MMM seems 
> infantile in comparison.

Only if someone considers this as fixed:

     int foo(int* p) { return p[1]; }
     int bar(int i) { return foo(&i); }

     clang++ -c test.cpp -Wall


and this as infantile:

     @safe:
     int foo(int* p) { return p[1]; }
     int bar(int i) {return foo(&i); }

     dmd -c test.d
     test.d(3): Error: safe function 'test.foo' cannot index pointer 'p'
     test.d(4): Error: cannot take address of parameter i in @safe function bar


More information about the Digitalmars-d mailing list