[petsc-dev] behavior of PetscDefined(PETSC_HAVE_CUDA)

Jed Brown jed at jedbrown.org
Fri Oct 16 12:22:45 CDT 2020


Patrick Sanan <patrick.sanan at gmail.com> writes:

> The man page for this seems to need fixing:
>
>     "Either way evaluates true if PETSC_USE_DEBUG is defined (merely defined or defined to 1) or undefined. This macro should not be used if its argument may be defined to a non-empty value other than 1."
>
> Is a 0 value allowed? If so, does it also evaluate to false?

It would evaluate false, though

#define CONFIG_VALUE 0

is a cpp antipattern because

#ifdef CONFIG_VALUE
  this executes
#endif

>
> The source check seems easy enough - reject anything that matches the following?
>
>     PetscDefined(\W*PETSC_

Sure.


More information about the petsc-dev mailing list