Skip to main content
`Ctrl`+`K`

# PetscUnlikelyDebug

Hints the compiler that the given condition is usually false, eliding the check in optimized mode

## Synopsis

    #include <petscmacros.h>
    bool PetscUnlikelyDebug(bool cond)

Not Collective; No Fortran Support

## Input Parameter

- cond - Boolean expression

## Note

This returns the same truth value, it is only a hint to compilers that the result of `cond` is likely to be false. When PETSc is compiled in optimized mode this will always return false. Additionally, `cond` is guaranteed to not be evaluated when PETSc is compiled in optimized mode.

## Example usage

This routine is shorthand for checking both the condition and whether PetscDefined(USE_DEBUG) is true. So

      if (PetscUnlikelyDebug(cond)) {
        foo();
      } else {
        bar();
      }

is equivalent to

      if (PetscDefined(USE_DEBUG)) {
        if (PetscUnlikely(cond)) {
          foo();
        } else {
          bar();
        }
      } else {
        bar();
      }

## See Also

`PetscUnlikely()`, `PetscLikely()`, `PetscCall()`, `SETERRQ`

## Level

advanced

## Location

include/petscmacros.h

Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages