Always use type-appropriate mechanisms to represent the absence of a value. For objects, use default constructors rather than nullptr. For potentially absent values, consider using optional types. For pointers, use null checks before performing operations on them.

Examples:

This practice improves type safety, prevents null pointer dereferences, and creates more maintainable code by using language features designed for representing absence of values.