Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
Is it acceptable for one header file to #include another?
Is it acceptable for one header file to #include another?
✍: Guest
It's a question of style, and thus receives considerable debate. Many people believe that ``nested #include files'' are to be avoided: the prestigious Indian Hill Style Guide disparages them; they can make it harder to find relevant definitions; they can lead to multiple-definition errors if a file is #included twice; they can lead to increased compilation time; and they make manual Makefile maintenance very difficult. On the other hand, they make it possible to use header files in a modular way (a header file can #include what it needs itself, rather than requiring each #includer to do so); a tool like grep (or a tags file) makes it easy to find definitions no matter where they are; a popular trick along the lines of:
#ifndef HFILENAME_USED
#define HFILENAME_USED
...header file contents...
#endif
(where a different bracketing macro name is used for each header file) makes a header file ``idempotent'' so that it can safely be #included multiple times; a clever compiler can avoid expending any more time on later instances of an already-included header; and automated Makefile maintenance tools (which are a virtual necessity in large projects anyway; andle dependency generation in the face of nested #include files easily.
2016-02-16, 1066👍, 0💬
Popular Posts:
How to set a HTML document's background color? document.bgcolor property can be set to any appropria...
What are urlencode() and urldecode() functions in PHP? string urlencode(str) - Returns the URL encod...
Who Developed HTML? HTML was originally developed by Tim Berners-Lee while at CERN, and popularized ...
What are some advantages and disadvantages of Java Sockets? Advantages of Java Sockets: Sockets are ...
Is XHTML Element Name Case Sensitive? - XHTML Tutorials - Introduction To Tag and Attribute Syntax Y...