google / google/wuffs

convert wuffs asserts into back-end asserts

Open
#77 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
4.8k
Forks
145
Avg merge
11h 48m
Merged PRs (30d)
1

Description

Can there be an option to convert wuffs-side asserts into asserts in the generated code?

This could be a macro which lets the user code pick which behavior to have for them.

So the assert can translate into nothing (like it is now), or a full error like `if not cond {return "#internal error: failed assert";}`, or an actual `assert(cond);`, or even an `assume(cond);`.

Theoretically the compiler should be able to optimize out all these checks but there will be cases where it cannot make the assumptions necessary like across a yield. This in turn could help the optimizer figure out better options based on the invariants that are present in wuffs but not present in the backend.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.