PetscCompl#

Expands to the integer complement of its argument

Synopsis#

#include <petscmacros.h>
int PetscCompl(b)

No Fortran Support

Input Parameter#

  • b - Preprocessor variable, must expand to either integer literal 0 or 1

Output Parameter#

  • <return- value> - Either integer literal 0 or 1

Notes#

Expands to integer literal 0 if b expands to 1, or integer literal 1 if b expands to 0. Behaviour is undefined if b expands to anything else. PetscCompl() will expand its argument before returning the complement.

This macro can be useful for negating PetscDefined() inside macros e.g.

  #define PETSC_DONT_HAVE_FOO PetscCompl(PetscDefined(HAVE_FOO))

Example usage#

  #define MY_VAR 1
  PetscCompl(MY_VAR) -> 0

  #undef  MY_VAR
  #define MY_VAR 0
  PetscCompl(MY_VAR) -> 1

See Also#

PetscConcat(), PetscDefined()

Level#

beginner

Location#

include/petscmacros.h


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