March 16, 2014 TDPL question: "objects may not embed internal pointers", classes too? | ||||
---|---|---|---|---|
| ||||
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? |
March 16, 2014 Re: TDPL question: "objects may not embed internal pointers", classes too? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | 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.
|
Copyright © 1999-2021 by the D Language Foundation