What would break if class was merged with struct

Ola Fosheim Grostad via Digitalmars-d digitalmars-d at puremagic.com
Sat May 27 13:40:13 PDT 2017


On Saturday, 27 May 2017 at 20:24:26 UTC, Moritz Maxeiner wrote:
> On Saturday, 27 May 2017 at 19:26:50 UTC, Ola Fosheim Grøstad 
> wrote:
>> 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?
>
> Yes, is is defined as `ptrsize` and must have the exact same 
> size as a pointer to a struct and - more importantly - a 
> pointer to a stack frame[1].

Huh? You are talking about lambdas?

Didnt find anything on class references in that Intel specific 
ABI, which appears to be optional anyway.


> Yes, see above link. Unless you make *all* stack frame pointers 
> smart pointers (which makes no sense whatsoever), class 
> instances cannot be smart pointers in the language as it is 
> specified right now.

I don't understand. Why are frame pointers relevant for class 
references?



> Sure, and the definition requires it.

Why?





More information about the Digitalmars-d mailing list