You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @brief Unwraps a pointer safely or terminates if it's null.
117
-
*
118
-
* Mimics Rust's `Option::unwrap()`.
119
-
*/
120
-
#defineunwrap(ptr) ((notnull(ptr)) ? (ptr) : (fprintf(stderr, "Fatal error: called unwrap() on a null pointer at %s:%d\n", __FILE__, __LINE__), exit(EXIT_FAILURE), null))
121
-
122
108
/**
123
109
* @brief Safely casts one pointer type to another with null-checking.
124
110
*
@@ -192,86 +178,6 @@ extern "C" {
192
178
*/
193
179
#definecempty""
194
180
195
-
/**
196
-
* @brief Ensure safe cleanup by nullifying pointers after use.
197
-
*
198
-
* Mimics Rust's memory safety using explicit pointer management.
199
-
*/
200
-
#definedrop(ptr) do { nullify(ptr); } while (0)
201
-
202
-
/**
203
-
* @brief Panic behavior for immediate program termination with error message.
204
-
*
205
-
* This macro causes the program to immediately terminate with an error message,
206
-
* similar to Rust's `panic!()` functionality.
207
-
*
208
-
* @param msg The message to display when panicking.
0 commit comments