3 ms·
> I find putting an API in a header file and an implementation in a translation unit really helps me reduce time later on. It's an automatic API summary withou
by wallacoloo 11y ago
> I find putting an API in a header file and an implementation in a translation unit really helps me reduce time later on. It's an automatic API summary without needing to review your implementation. When I move on from one part of a program to another, I don't want to study my source code just to remember what the access is. Just show me the header. I miss header files in other languages.
`make doc` (maybe as part of your build process even), then view the autogenerated API documentation. This is at least a feature or extension of most languages. C++ even has a number of documentation suites (e.g. Doxygen, IIRC).
Furthermore, if you're using a "good" IDE, I would expect it to be able to provide you the same basic information you get from header files (i.e. method signature & names). It could at the very least have a "collapse function implementations" hotkey to allow you to view a source file as if it were essentially a header file.
I don't know, the fact that it's somewhat trivial to actually generate a .h file given a .c or .cpp file (look up LZZ - Lazy C++; it's not maintained, but it did exactly this) makes them seem pretty much useless to me.