Skip to main content

Diagnostics

  • Chapter
  • First Online:
  • 2199 Accesses

Abstract

Assertions are Boolean expressions that are expected to be true at a given point in the code. The assert macro of <cassert> is defined similar to

#ifdef NDEBUG  #define assert(_) #else  #define assert(CONDITION) \    if (!(CONDITION)) { print_msg(__FILE__, __LINE__, ...); std::abort(); } #endif

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   34.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   44.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 1.

    A mixin is a class that provides some functionality to add to other classes (in this case, the capability of storing a pointer to a nested exception and some related functions). In C++, mixins are generally implemented through multiple inheritance.

  2. 2.

    std::exp() only sets errno for implementations where math_errhandling defined in <cmath> contains MATH_ERRNO: see Chapter 1. This appears to be mostly the case though.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Peter Van Weert and Marc Gregoire

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Van Weert, P., Gregoire, M. (2019). Diagnostics. In: C++17 Standard Library Quick Reference. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-4923-9_8

Download citation

Publish with us

Policies and ethics