Garbage collected pointers?

John Burton john.burton at jbmail.com
Thu Mar 1 10:10:27 UTC 2018


In the language spec here :-
https://dlang.org/spec/garbage.html#pointers_and_gc

It refers to a distinction between pointers to garbage collected 
memory and pointers that are not. In particular it says that with 
a non garbage collected pointer you can do anything  that is 
legal in C but with a garbage collected pointer there are a lot 
of undefined behaviors if you don't follow some restrictions.

My question is how do I tell if a pointer is "garbage collected" 
or not?

For example :-
* Do not store magic values into pointers, other than null.

So how do I tell if it's safe to do this for any individual 
pointer? What makes a pointer "garbage collected"?


More information about the Digitalmars-d-learn mailing list