Re: [PATCH 1/3] Fix mismatched struct vs class tags.

Simon Marchi
2016-11-30T17:54:39Z

On 2016-11-30 12:08, Pedro Alves wrote:
>> I think it will have to be done at some point... it will be a bit
>> weird
>> and counter intuitive for newcomers to see .c files containing C++.
>> That, and analysis tools that select the language based on the
>> extension. For example, I use Eclipse CDT for my development, and it
>> assumes C code for .c files by default. I can go change some obscure
>> setting to force it to consider it as C++, but it would be nicer for
>> everybody if we didn't have to do that. Actually, I just checked and
>> it's the same with vim and emacs. If we want to do it right, we would
>> have to rename .h into .hpp or .hh as well. And it would be as
>> painful
>> to do it in 5 years as it would be to do it now, so I don't see why we
>> would wait...
>
> ".hh" and ".hpp" just look weird to me (for not being used to it,
> no doubt). But how are these tools handling the massive number
> of projects that use ".h" for C++ code?

In Eclipse CDT, if you create a C++ project, .h files will be treated as
C++, but .c files will be treated as C. vim seems to do always treat .h
files as C++. When I open "vim test.h", the file type is C++ right
away. So it would be fine in that regard to keep header files as .h.