struct and default constructor

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 10 09:23:03 PDT 2014


On 10/10/2014 3:23 AM, Szymon Gatner wrote:
> Bit OT: What is The D code style then? It would be very useful for those coming
> from C++ to have a wiki/article on how to translate C++ idioms and practices to
> D. I too am writing D code like I do my C++ and often find myself puzzled
> (deterministic d-tors being perfect example). Missing default struct c-tor is
> also one of such examples - and adding opCall() feels hacky.

You're right, but it's a bit of a difficult question to answer. Other examples 
that cause people grief:

1. using ref as a type constructor
2. multiple inheritance
3. using a struct as both a value and a polymorphic type

These are idiomatic C++ usages that need to be rethought for D.



More information about the Digitalmars-d mailing list