|
From: | Rik |
Subject: | [Octave-bug-tracker] [bug #61753] Changing assert to panic_impossible |
Date: | Mon, 3 Jan 2022 14:25:57 -0500 (EST) |
User-agent: | Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36 |
Update of bug #61753 (project octave): Status: None => In Progress _______________________________________________________ Follow-up Comment #5: Attached is a stab at writing a function "panic_if (COND)" which is just syntactic sugar for if (COND) panic_impossible (); The function is declared inline so there should never be any function calling overhead. The body of the function is enclosed by #ifndef NDEBUG ... #endif so if NDEBUG is defined during compilation the entire code construct should be optimized out by the compiler. I put this new function in error.h since that is where panic_impossible() is. Any code already using panic_impossible() should be including error.h. @jwe: Could you review for correctness? Final thought, can the macro "panic_impossible" also be replaced by a C++ inline function? _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?61753> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/
[Prev in Thread] | Current Thread | [Next in Thread] |