What does pragma once mean? I found it in some header files.

Q

What does pragma once mean? I found it in some header files.

✍: Guest

A

It is an extension implemented by some preprocessors to help make header files idempotent; that is, to make sure that their contents are processed exactly once even if they are #included multiple times.Some people claim that #pragma once can be implemented ``more efficiently'' (of course only compilation efficiency is a factor here), but in fact a preprocessor that is serious about compilation efficiency can arrange for the portable #ifndef trick to be handled just as efficiently.

2015-12-11, 916👍, 0💬