Variables of struct and class types are called objects - discuss

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Sun Aug 3 11:25:03 UTC 2025


On 03/08/2025 11:11 PM, Brother Bill wrote:
> Am curious whether experienced D developers actually refer to both 
> struct and class variables as "objects" without confusion.

Strictly speaking the definition from the C standard:

"region of data storage in the execution environment, the contents of 
which can represent values"

So it can describe a struct or class instance, but not a field.

I split the definition based upon what I am doing.

If its memory allocation, symbol representation type stuff, it'll be the 
C definition.
Otherwise I'll use the class description.

For most people they can stick with the class description, they don't 
need to know how C describes it, they are not working with the memory 
model at that level.


More information about the Digitalmars-d-learn mailing list