Skip to content

Fail fast on invalid null arguments #239

@ChrisThrasher

Description

@ChrisThrasher

Macros like CSFML_CALL aim to be friendly to users who incorrectly pass NULL to a parameter that expects a non-null argument. In some cases this results in functions that return placeholder values or short-circuit their logic to avoid a null pointer deref. What I like about this approach is that it results in well-defined behavior in all build types.

What I propose instead is a simpler approach where we eliminate most macros in Internal.h in favor of a simpler CSFML_ASSERT macro that terminates the program (perhaps with a helpful log message) when invalid null arguments are found. I'd rather users be notified ASAP that their code is incorrect than CSFML make attempts to gracefully handle code that users should have never written in the first place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions