Skip to content

Semantics of error() vs halide_assert() in runtime code aren't clear enough #5310

@steven-johnson

Description

@steven-johnson

To report errors correctly when writing runtime code, you must be pretty familiar with some internals that aren't obvious enough to a newcomer to the code; we should do something to make this more obvious. The current situation:

  • halide_assert() should be used only for unrecoverable failures; it always calls halide_abort().
  • error() should be used for potentially recoverable errors
    • Since it calls halide_error(), which may-or-may-not-return depending on the client, calls to error() in the runtime must also return an error code; this is an easy thing to omit. Is there a way we can enforce this syntactically?

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationMissing, incorrect, or unclear. Spelling & grammar mistakes.enhancementNew user-visible features or improvements to existing features.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions