Skip to content

Commit

Permalink
Tweaking terminateApplication
Browse files Browse the repository at this point in the history
  • Loading branch information
gershnik committed Mar 31, 2022
1 parent 84ad61a commit f18d38d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,11 @@ For reference this is the default implementation

```cpp
[[noreturn]] inline void Argum::terminateApplication(const char * message) {
fprintf(stderr, "%s\n", message);
fflush(stderr);
#ifndef NDEBUG
assert(message && false);
assert(false);
#else
fprintf(stderr, "%s\n", message);
fflush(stderr);
std::terminate();
#endif
}
Expand Down
7 changes: 4 additions & 3 deletions inc/argum/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

#define ARGUM_INVALID_ARGUMENT(message) ::Argum::terminateApplication(message)


#if defined(__GNUC__)
#ifndef __EXCEPTIONS
#define ARGUM_NO_THROW
Expand All @@ -69,11 +70,11 @@ namespace Argum {

#ifndef ARGUM_CUSTOM_TERMINATE
[[noreturn]] inline auto terminateApplication(const char * message) -> void {
fprintf(stderr, "%s\n", message);
fflush(stderr);
#ifndef NDEBUG
assert(message && false);
assert(false);
#else
fprintf(stderr, "%s\n", message);
fflush(stderr);
std::terminate();
#endif
}
Expand Down

0 comments on commit f18d38d

Please sign in to comment.