json/docs/mkdocs/docs/api/macros/json_noexception.md
Niels Lohmann 6a7392058e
Complete documentation for 3.11.0 (#3464)
* 👥 update contributor and sponsor list

* 🚧 document BJData format

* 🚧 document BJData format

* 📝 clarified documentation of [json.exception.parse_error.112]

* ✏️ adjust titles

* 📝 add more examples

* 🚨 adjust warnings for index.md files

* 📝 add more examples

* 🔥 remove example for deprecated code

* 📝 add missing enum entry

* 📝 overwork table for binary formats

*  add test to create table for binary formats

* 📝 fix wording in example

* 📝 add more examples

* Update iterators.md (#3481)

*  add check for overloads to linter #3455

* 👥 update contributor list

* 📝 add more examples

* 📝 fix documentation

* 📝 add more examples

* 🎨 fix indentation

* 🔥 remove example for destructor

* 📝 overwork documentation

* Updated BJData documentation, #3464 (#3493)

* update bjdata.md for #3464

* Minor edit

* Fix URL typo

* Add info on demoting ND array to a 1-D optimized array when singleton dimension

Co-authored-by: Chaoqi Zhang <prncoprs@163.com>
Co-authored-by: Qianqian Fang <fangqq@gmail.com>
2022-05-17 13:08:56 +02:00

1.1 KiB

JSON_NOEXCEPTION

#define JSON_NOEXCEPTION

Exceptions can be switched off by defining the symbol JSON_NOEXCEPTION. When defining JSON_NOEXCEPTION, #!cpp try is replaced by #!cpp if (true), #!cpp catch is replaced by #!cpp if (false), and #!cpp throw is replaced by #!cpp std::abort().

The same effect is achieved by setting the compiler flag -fno-exceptions.

Default definition

By default, the macro is not defined.

#undef JSON_NOEXCEPTION

Notes

The explanatory what() string of exceptions is not available for MSVC if exceptions are disabled, see #2824.

Examples

??? example

The code below switches off exceptions in the library.

```cpp
#define JSON_NOEXCEPTION 1
#include <nlohmann/json.hpp>

...
```

See also

Version history

Added in version 2.1.0.