# PetscLikely
Hints the compiler that the given condition is usually true 
## Synopsis
```
#include <petscmacros.h>
bool PetscLikely(bool cond)
```
Not Collective


## Input Parameter

- ***cond -*** Boolean expression



## Notes
Not available from fortran.

This returns the same truth value, it is only a hint to compilers that the result of cond is
likely to be true.


## Example usage
```none
  if (PetscLikely(cond)) {
    foo(); // hot path
  } else {
    bar(); // cold path
  }
```





## See Also
 `PetscUnlikely()`, `PetscDefined()`, `PetscHasAttribute()`
`PETSC_ATTRIBUTE_COLD`

## Level
advanced

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