Current state of "D as a better C" (Windows)?

Frank Bauer y at z.com
Sat Jan 25 18:03:28 PST 2014


On Saturday, 25 January 2014 at 23:02:44 UTC, anonymous wrote:
> C doesn't have new/delete.

Please read-before-write (non atomic operation): C has the 
*semantics* of new / delete with malloc and free. D has too, if 
you constrain yourself to memory allocation via 
std.c.stdlib.malloc and free, which means no object allocation 
with *new* anymore. We don't want to constrain ourselves to that, 
do we? What we want is malloc/free *semantics* throughout if we 
choose so.

> You can do C style array/pointer fiddling in D without the GC. 
> You can't new or append, but you can't do that in C either. 
> Seems to me, you're comparing more to C++/Rust than to C.

> You have access to C's standard library from D.

I'm aware that I can use a D subset that is roughly equivalent to 
C and C's standard library. This subset is precisely what I am 
*not* talking about. I am talking about all the great modern 
architectural features of D and Phobos.

> Your points don't apply to D vs C.

It does if I want to use D in its entirety not just its subset 
equivalent to C.

So if I want C++ new/delete or Rust's owned pointer semantics I 
should constrain myself to D's subset that is equivalent to C and 
forget about Phobos altogether? Welcome to the *new* D.



More information about the Digitalmars-d mailing list