www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - TDPL question: "objects may not embed internal pointers", classes too?

reply "Adam D. Ruppe" <destructionator gmail.com> writes:
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?
Mar 16 2014
parent "Frustrated" <Frustrated nowhere.com> writes:
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.
Mar 16 2014