Pointer validity checking and documentation