Should we use only #pragma once or only include guards? (was ACTS-450)
Original author Robert Johannes Langenberg @rlangenb
Currently we use both #pragma once and include guards (though mostly the latter). We should decide for only one of the two.
#pragma once is non-standard but supported by all major compilers. It only requires a statement (at the top?) as opposed to one statement at the beginning and one at the end, as include guards do. Include guards requires the programmer to create a unique identifier, in case of collisions one file will not be included. pragma once uses a heuristic to find out if two files are the same, which may fail for very similar (e.g. copied) files.
My preference would be to switch to pragma once
Please discuss and/or vote:
A) Switch to #pragma once
B) Use include guards everywhere
Edited by Moritz Kiehn