Garbage collected pointers?

Steven Schveighoffer schveiguy at yahoo.com
Thu Mar 1 19:52:26 UTC 2018


On 3/1/18 2:04 PM, Jonathan M Davis wrote:
> On Thursday, March 01, 2018 10:55:34 Steven Schveighoffer via Digitalmars-d-
> learn wrote:
>> It should really say that it's up to the GC implementation whether it's UB
>> or not.
> 
> Well, that arguably makes it UB in general then, because it can't be relied
> on. By putting restrictions on the GC in general based on what types of GCs
> theoretically could be used, it makes it so that D code in general could
> theoretically work with any GC that fits the bill, whereas if the rules of
> what was allowed changed depending on the GC being used, what was valid D
> would effectively change depending on the GC.

There are a few in there, which I think are over-the-top. Such as "don't 
cast a pointer to a non-pointer", or "Do not take advantage of alignment 
of pointers to store bit flags in the low order bits". I can't conceive 
of any GC that would have fits with either of these things without 
breaking pretty much everything. While I can't conceive of it, it 
doesn't mean there isn't a reason for it. But clearly the reason isn't 
currently implemented.

-Steve


More information about the Digitalmars-d-learn mailing list