Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect use of catch unreachable #106

Open
tauoverpi opened this issue Jan 5, 2025 · 1 comment
Open

Incorrect use of catch unreachable #106

tauoverpi opened this issue Jan 5, 2025 · 1 comment

Comments

@tauoverpi
Copy link

tauoverpi commented Jan 5, 2025

https://github.com/search?q=repo%3Acapy-ui%2Fcapy%20unreachable&type=code

The majority of cases of unreachable within this codebase are not correct and introduce undefined behaviour upon failure which is catastrophic for consumers of this library as if any of the operations fail the program could do anything (even play a game of tetris or fire all missiles). If the intent was to @panic() then such should be done explicitly or where the user should handle error, an error union.

https://ziglang.org/documentation/master/#unreachable

In ReleaseFast and ReleaseSmall mode, the optimizer uses the assumption that unreachable code will never be hit to perform optimizations.

https://ziglang.org/documentation/master/#Reaching-Unreachable-Code

Additional reading:

@zenith391
Copy link
Member

Yes you're right. I did end up using catch unreachable a bit too liberally while prototyping and forgot to remove them when commiting. Over time.. it accumulates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants