What would break if class was merged with struct
Ola Fosheim Grøstad via Digitalmars-d
digitalmars-d at puremagic.com
Sat May 27 12:26:50 PDT 2017
On Saturday, 27 May 2017 at 19:01:12 UTC, Moritz Maxeiner wrote:
> Here, `bar`, takes a (pointer to a) class instance as parameter
> `foo`. `foo` is a single pointer, i.e. 8 bytes on a 64bit OS,
> with *no* special semantics.
Does the language spec say anything about the size of class
references?
> If you want a smart pointer, use one, but don't suddenly make
> something that isn't a smart pointer by language design change
> shape into a smart pointer.
Is it specified?
The common implementation uses a GC, but does it say that an
implementation cannot use a reference counted smart pointer or a
fat pointer instead?
> Sure, but then type `Foo` in the above must remain a normal
> pointer, not become a smart pointer.
That really depends on the definition of the language.
More information about the Digitalmars-d
mailing list