Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualEctara

Posted 05 February 2013 - 05:43 PM

Seriously, use both. The pragma avoids token clashes, and the include guards serve as a fallback on the exceedingly rare case you're compiling on an implementation that doesn't support it.

What if the compiler decides to implement it to mean something else? Since it isn't standardized, they are allowed to (no matter how unlikely) implement in a way that may perform something unwanted.

EDIT: My point here was to say use it after researching and proving that #pragma once is worth the risk of non-standard behavior, if you can prove what it will do, and that all compilers you use will implement it in a similar fashion. Saying to use it "just because" is allowed to be problematic, same as relying on alignment rules. Most compilers will try their hardest to allow users' codebases to be compatible with others in this aspect, but not all will. Research first.


#3Ectara

Posted 05 February 2013 - 05:42 PM

Seriously, use both. The pragma avoids token clashes, and the include guards serve as a fallback on the exceedingly rare case you're compiling on an implementation that doesn't support it.

What if the compiler decides to implement it to mean something else? Since it isn't standardized, they are allowed to (no matter how unlikely) implement in a way that may perform something unwanted.

EDIT: My point here was to say use it after researching and proving that #pragma once is worth the risk of non-standard behavior, if you can prove what it will do, and that all compilers you use will implement it in a similar fashion. Saying to use it "just because" is allowed to be problematic, same as relying on alignment rules. Most compilers will try their hardest to allow user's codebase to be compatible with others in this aspect, but not all will. Research first.


#2Ectara

Posted 05 February 2013 - 05:41 PM

Seriously, use both. The pragma avoids token clashes, and the include guards serve as a fallback on the exceedingly rare case you're compiling on an implementation that doesn't support it.

What if the compiler decides to implement it to mean something else? Since it isn't standardized, they are allowed to (no matter how unlikely) implement in a way that may perform something unwanted.

EDIT: My point here was to say use it after researching and proving that #pragma once is worth the risk of non-standard behavior, if you can prove what it will do, and that all compilers you use will implement it in a similar fashion. Saying to use it "just because" is allowed to be problematic, same as relying on alignment rules. Most compilers will try their hardest to be compatible to allow user's codebase to be compatible with others in this aspect, but not all will. Research first.


#1Ectara

Posted 05 February 2013 - 04:50 PM

Seriously, use both. The pragma avoids token clashes, and the include guards serve as a fallback on the exceedingly rare case you're compiling on an implementation that doesn't support it.

What if the compiler decides to implement it to mean something else? Since it isn't standardized, they are allowed to (no matter how unlikely) implement in a way that may perform something unwanted.


PARTNERS