Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Instead of "#ifndef _SOME_HOPEFULLY_UNIQUE_NAME_H" I've started using "#pragma once" -- it's likely supported by every compiler you care about.

http://en.wikipedia.org/wiki/Pragma_once



That can cause problems if a header is accessible by two different paths (which is not uncommon in a large project). Using both gives you maximum efficiency without sacrificing correctness, and it works everywhere.


Thanks, I wasn't aware that it was that well supported. Reading more about this, I also learned that GCC supports the Obj-C once only #import in C and C++ as well.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: