# 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 support 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
```none
  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
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/include/petscmacros.h.html#PETSC_CONSTEXPR_14">include/petscmacros.h</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/include/petscmacros.h)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
