I suggest that we reopen this discussion in light of the recent discovery that I made. Over the past 9 years, I have used the following naming convention for source files in my C and C ++ projects.
- C = Direct source code C containing one or more related entry points
- CPP = C ++ source code containing one or more related entry points
- H = Declaration of functions, macros, structures, typedefs, etc.
- INL = Inline (function bodies), which are the bodies of two or more functions, the main definition file of which is the C or CPP file in which they are included: #include
An example of these common function bodies, MyStringFunctionA, an ANSI implementation, is defined in MyStringFunctionA.cpp, and the implementation of MyStringFunctionW, Unicode (wide character), is defined in MyStringFunctionW.cpp. MyStringFunctionA.cpp and MyStringFunctionW.cpp contain prototypes that open and close brackets and headers, provided UNICODE for the wide-character version. The body of the function is defined in the INI file, which contains # built-in built-in function definition block.
Combined with the universal TCHAR mappings, this approach greatly simplifies support for the Unicode and ANSI versions that remain in active use.
This naming convention worked great with Visual Studio 6. However, when I started migrating my code base in Visual Studio 2013, I found that the change annoyed me. Although everything was compiled when one of my INL files was opened in the code editor, I will see dozens of Intellisense errors listed in the Errors window. I quoted the term “errors” because these are not true errors; they disappear when the INL file is closed, and the C and CPP files into which iNL is pulled are compiled without errors, links, and run correctly.
David A. Gray
source share