Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

Use of assert!() and debug_assert!() #7

Open
Wrench56 opened this issue Jul 2, 2024 · 0 comments
Open

Use of assert!() and debug_assert!() #7

Wrench56 opened this issue Jul 2, 2024 · 0 comments

Comments

@Wrench56
Copy link
Collaborator

Wrench56 commented Jul 2, 2024

Previously, we decided during charlotte_core development that assert!() macros are to be avoided. They are unambigious, coming from a C environment might make you think that they are compile time asserts, in reality, they are runtime checks in Rust. Additionally, they panic, the whole point of this repository is to provide a non-panicing alloc module. Note: debug_alloc!() is NOT included in release builds, but they are included in debug build. I believe we should not be using any of the assert!()-s to keep things simple. Especially in this library, since panicing here is fatal for the OS.

Files such as lib.rs do use debug_assert!() statements, please either remove them, or even better, somehow check them but without panicing. Returning a Result is one way of fixing these things, another would be to use the already discussed "callback logger".

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

No branches or pull requests

1 participant