Compare commits
1 Commits
008283e1f8
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| a8796feb37 |
@@ -111,8 +111,8 @@ The assert module provides diagnostic macros made to trap critical logic failure
|
||||
#### Macros and their behavior
|
||||
| Macro | Debug Mode (`_DEBUG`) | Release Mode |
|
||||
| :--- | :--- | :--- |
|
||||
| `ASSERT(cond, msg)` | Evaluates `cond`. If `false`, logs the error location, pops up an interactive modal error box, drops a debugger breakpoint trap, and calls `std::exit`. | Evaluates to a compiler optimization hint informing the optimizer that `cond` is always `true`. |
|
||||
| `PANIC(msg)` | Logs the error, displays an interactive modal error box, breaks execution, and terminates. | Logs the error, displays an interactive modal error box, breaks execution, and terminates. **Always halts execution.** |
|
||||
| `ASSERT(cond, msg)` | Evaluates `cond`. If `false`, logs the error location, pops up an error box, drops a debugger breakpoint trap, and calls `std::exit`. | Evaluates to a compiler optimization hint informing the optimizer that `cond` is always `true`. |
|
||||
| `PANIC(msg)` | Logs the error, displays an error box, breaks execution, and terminates. | Logs the error, displays an error box, breaks execution, and terminates. **Always halts execution.** |
|
||||
#### Example
|
||||
```c++
|
||||
#include <seallib/assert.h>
|
||||
@@ -145,7 +145,7 @@ void processNetworkPacket(int packetId) {
|
||||
}
|
||||
|
||||
int main() {
|
||||
// Fails in debug: triggers a modal error window detailing the file and line number
|
||||
// Fails in debug: displays an error window detailing the file and line number
|
||||
processSystemData(nullptr, -1);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user