Boost logo

Boost :

Subject: [boost] Guidence on #pragma once
From: Robert Ramey (ramey_at_[hidden])
Date: 2018-11-23 23:36:20

In the safe numerics library my *.hpp files start with the following
boiler plate:


// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once


I would like to replace all this in every file with just

#pragma once

according to

this should be possible while supporting almost all which claim to be
C++ 14 conformant. The exception noted is C++ for Cray.

I realize that strictly speaking I shouldn't do this. But it would
instantaneously remove some cruft from my code as long as the occasional
error from repeating the same include guard text in multiple files. It
might have some performance benefits and some other repercussions
related to pre-compiled headers. Who knows what else. It would be
interesting to know what others might have to say about this.

Robert Ramey

Boost list run by bdawes at, gregod at, cpdaniel at, john at