# PetscHasBuiltin
Determine whether a particular builtin method is supported by the compiler 
## Synopsis
```
#include <petscmacros.h>
int PetscHasBuiltin(name)
```

## Input Parameter

- ***name -*** the name of the builtin routine



## Notes
Evaluates to `1` if the builtin is supported and `0` otherwise. Note the term "evaluates"
(vs "expands") is deliberate; even though `PetscHasBuiltin()` is a macro the underlying
detector is itself is a compiler extension with implementation-defined return type and
semantics. Some compilers implement it as a macro, others as a compiler function. In practice
however, all supporting compilers return an integer boolean as described.


## Example Usage
Typical usage is in preprocessor directives

```none
  #if PetscHasBuiltin(__builtin_trap)
  __builtin_trap();
  #else
  abort();
  #endif
```


But it may also be used in regular code

```none
  if (PetscHasBuiltin(__builtin_alloca)) {
    foo();
  } else {
    bar();
  }
```





## See Also
 `PetscHasAttribute()`, `PetscAssume()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/include/petscmacros.h.html#PetscHasBuiltin">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)  
