PETSc version 3.17.4
Fix/Edit manual page

PETSC_CONSTEXPR_14

C++14 constexpr

Notes

Equivalent to constexpr when using a C++ compiler that supports C++14. Expands to nothing if the C++ compiler does not suppport C++14 or when not compiling with a C++ compiler. Note that this cannot be used in cases where an empty expansion would result in invalid code. It is safe to use this in C source files.

Fortran Notes

Not available in Fortran

Example Usage

  PETSC_CONSTEXPR_14 int factorial(int n)
  {
    int r = 1;

    do {
      r *= n;
    } while (--n);
    return r;
  }

See Also

PETSC_NULLPTR, PETSC_NODISCARD

Level

beginner

Location

include/petscmacros.h
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages