pragma directive

Saw this on Isaac ROS code at NVIDIA.

The pragma directive is a special purpose directive and is used to turn on or off some features. They are compiler-specific.

Resources

They use like this

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
...
#pragma GCC diagnostic pop

pragma once

So apparently you can use #pragma once instead of the #ifndef.

The thing is that ifndef is standardized, whereas pragma is compiler specific.

But this is what we do at NVIDIA at the top of every .hpp file

#pragma once

Discussion