I am +1 on using pragma once for ease of use. However, there is no performance gain on compilation. Modern compilers are already optimized for include guards.
-Bryan > On Jul 31, 2017, at 7:52 AM, Jason Kenny <jke...@yahoo-inc.com.INVALID> wrote: > > I want to bump this again. I started moving to this already. However James > Peach was wanting to talk about this in dev for a different code review by > someone else. I personally took the lack of discussion here a sign this was > obvious ok, and a good thing to do as it is generally standard practice by > most modern C++ people. However, this may not be so. So I want to bring the > discussion on this again, for those that want to use inefficient #ifdef > guards over the more modern #prgama once replacement. > Jason > > On Friday, July 7, 2017, 2:07:14 PM CDT, Jason Kenny <jke...@yahoo-inc.com> > wrote: > > Hi all, > I would suggest we start using > #pragma once > instead of the classic header guard of > #ifndef MYHEADER_H > #define MYHEADER_H > ...#endif //MYHEADER_H > The reason for this is that #pragma once: > 1) is supported on all the compilers and all the platform combination we use > for quite some time now. 2) it is easier to use than trying to deal with > header guards, such as getting the name correct etc..3) the compiler already > can optimize loading of headers better with pragma once, so compile times > will only be faster and safer than before > I suggest we allow the usage on new headers or in a code diff in which we > clean up the code. We can use both at the same time without issue. This is a > very safe and nice change to make > Jason