TDPL question: "objects may not embed internal pointers", classes too?

Frustrated Frustrated at nowhere.com
Sun Mar 16 15:10:23 PDT 2014


On Sunday, 16 March 2014 at 18:41:51 UTC, Adam D. Ruppe wrote:
> On page 249 of TDPL (Andrei's book), in a section on structs 
> and postblits, it says "D objects must be relocatable" and 
> other similar statements while banning internal pointers.
>
> I knew this applies to structs and the context makes that 
> plainly clear, but the word "object" is a bit ambiguous: does 
> this apply to classes too?

And object is an instantiation of a class. I guess it could be 
ambiguous but generally I think object = class(misnomer but 
simple). Structs can exist on the heap and be very similar to 
objects and I suppose it is possible to allocate classes on the 
stack so theoretically I guess it is ambiguous but in programming 
parlance it is not.


More information about the Digitalmars-d-learn mailing list