Pointers are great

11 points · 3 comments · view on lemmy.world

3 Comments

ZILtoid1991@kbin.social · 1 pts · 3y (2 replies)

The greatest fixes to all your pointer issues:

  1. Use a debugger, so you'll know when it happens.
  2. A simple safety check goes very far, and is easy to implement.
if (refVal != null) {
    //Do the thing
} else {
    //Optional in case if your reference value is uninitialized, can be useful for certain things too
}

Lenguador@kbin.social · 2 pts · 3y (1 reply)

The greatest fix to all your pointer issues are to use references.

ReCursing@kbin.social · 1 pts · 3y

Or using a different programming language that abstracts all that shit away because the people who made it are almost certainly better at memory management than I am!