The reason I’m bringing this up is that I was approached multiple times, because the C++ header files I added to blenlib added confusion and were a bit annoying. The issue is that when writing C code, you were able to include any file with a name like
BLI_*.h. Now, you can’t. Since autocompletion and file browsers often only show the file name, you actually have to open the file to see whether you can include it in C code or not.
If I remember correctly, we made that decision, because it is convenient that C and C++ have the same extension, when writing C++ code. This argument works well for header files in e.g.
depsgraph/intern/builder/, because there are no C headers in that directory. We did not really think about the fact that this adds inconvenience to writing C code. And since Blender is still mostly C code, it is probably better to make writing C++ code a bit less convenient instead.
Personally, I’m writing more C++ code than C code for Blender currently, so I’m not much affected by the issue. Therefore, it would be good if other developers can share their opinion on the topic. If we just use this thread to confirm our last decision again, that’s fine with me.
We also decided that new C++ files should use the extension
.cc (instead of
.cpp). However, I don’t feel like we have to discuss that again. Just wanted to mention it here.
Outcome of the discussion: Use
.hh for C++ header files.