Quoting from Microsoft documentation, There is no advantage to use of both the #include guard idiom and #pragma once in the same file.
Answers to previous related questions on stackoverflow also confirm that it is pointless to have both. See below, for instance:
The boost
library's vector.hpp
file, however, starts thus:
#ifndef BOOST_ASSIGN_STD_VECTOR_HPP
#define BOOST_ASSIGN_STD_VECTOR_HPP
#if defined(_MSC_VER)
# pragma once
#endif
...
#endif
That is, it includes both the guard idiom as well as the pragma once. Is there any reason why boost header files have both?
See Question&Answers more detail:os