Is an automatic string variable a dynamic array in the sense of sec. 10.11.2 "Identity Expression" par. 4?

Quirin Schroll qs.il.paperinik at gmail.com
Tue Jul 19 16:39:48 UTC 2022


On Saturday, 16 July 2022 at 13:03:42 UTC, Mathias LANG wrote:
> Another way to express `is` would be to say: their immediate 
> value are binary equivalent. For value type it's simple (it 
> also means that `float.init is float.init` but not all NaN will 
> be equal obviously), but for reference type, it's just 
> comparing their pointer (and for arrays, their length).

I wouldn’t use the term “binary equivalent”. It sounds… wrong – 
and I’ll tell you why. We’re in precise-definition territory. 
Here, “equivalent” is not the same as “equal”. If I’m not 
horribly mistaken, the `is` operator for value types plainly 
compares the bytes, that is, the bytes are equal. I could imagine 
a definition for “binary equivalent” that is different from 
“binary equal”: Padding bits are ignored and if the struct has 
internal pointers, those point to the same offset, respectively. 
Of course, that is a vague term, as “equivalent” usually is in 
contrast to “equal”.


More information about the Digitalmars-d mailing list