tags:

views:

83

answers:

2

Hi,

I first encountered files ended with .tc and .th in a C library (http://www.vlfeat.org/api/files.html, only .tc files are listed there. To see .th file, one has to download its source code http://www.vlfeat.org/download/vlfeat-0.9.5-bin.tar.gz. They are under vl directory.). Just wonder what do they mean and relation with normal .h and .c files ?

Thanks and regards!

+2  A: 

They use those as a template and the files are not compiled directly, but by being #included in the corresponding .c or .h file after setting #defines that affect the final result.

One example is what happens in mathop_sse2.c. They include the same mathop_sse2.tc twice, but the first time FLT is defined as VL_TYPE_DOUBLE and the second time is VL_TYPE_FLOAT. That way they avoid duplicating the exact same code for different types.

Gonzalo
what is the difference between .th and tc then?
Tim
The .th files do not contain code, just definitions and declarations. The .tc files have actual C code instead.
Gonzalo
A: 

Seems most likely these files were written using the Borland compiler.

DanDan
Really? They can be compiled in gcc.
Tim
Could possibly have just been a quick work around for excluding files from the project.
DanDan