Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use #pragma once instead of traditional include guards #54

Open
gablank opened this issue Jan 11, 2016 · 0 comments
Open

Use #pragma once instead of traditional include guards #54

gablank opened this issue Jan 11, 2016 · 0 comments

Comments

@gablank
Copy link
Collaborator

gablank commented Jan 11, 2016

Use #pragma once instead of

ifndef THIS_HEADER

define THIS_HEADER

endif // THIS_HEADER

to avoid including headers more than once. This has several benefits, two of them being:

  • Avoid polluting the macro namespace
  • Harder to do something wrong (like defining something different from what youre are #ifndef-ing)

Compiler support: All major (GCC >= 3.4).

See https://en.wikipedia.org/wiki/Pragma_once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant