Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-core-dev] Re: Manipulate Include statements in C++ source file

kesselhaus> Hmm, for me it sounds not to be wrong including a file more 
than once in
kesselhaus> C/C++! Java might be unhappy about this, but in C/C++ there is 
nothing wrong
kesselhaus> about this. I'd say, for this case you should check yourself 
if the include
kesselhaus> is already there and put it again into the file or not.

I would agree - we use .H files in two distinct ways:

Method #1 - standard "run-of-the-mill" prototypes and defines.

Method #2 - as a means to create tables - normally with fancy 
C-preprocessor pasting.

        A good example of this is in the GCC source code. Technically - in 
GCC 
        the are "def" files - not .H files, the file name extension varies 
depending
        upon the person implementing it.

        Search the GCC source code for '.def' files you'll find many.

In our case, we have a generated header file for a library.
Applications include this header file 2 different ways:

(A) - by default - they get function prototypes, variable externs, and 
#defines.
        [ie: to get the function prototypes]

(B) - By defining a special macro - they can create various tables.
        [ie: to create a table of "command string name" vrs function 
pointer]

-Duane.



Back to the top