Interview Questions

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

C Interview Questions and Answers


(Continued from previous question...)

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

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.

(Continued on next question...)

Other Interview Questions