null^stray^uninitialized^void pointer

$ dangling/wild/stray ptr and *ref* — holds an address but already bulldized, possibly *reused* => u can’t delete, write or read the memory location. Merely reading (not touching) someone else’s memory location can have unknown effects — like incrementing a read counter.

P132 effC++ confirms a dangling reference can point to a memory cell already reused by someone else.

$ uninitialized/unseated ptr — address[2] undefined and could be a completely wrong address mapped to some program’s hot button => u can’t delete, write or read it. Always anchor your pointer before dereferencing.
[2] However, ptr object has an address and occupies 4 bytes

Objects can be uninitialized  too. See post on default-initialize.

$ uninitialized ref? won’t compile

$ null ptr — address 0, interpreted as a well-defined fake address. Safe deletion
$ null ref? won’t compile

$ void ptr — java. qq[ Object o ]
$ void ref? won’t compile

For each of these special scenarios, delete, deref/unwrap, detection (of null…), compare, reseat, assign … have special semantics.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s