Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.h -> .hpp in classbuilder #999

Closed
wants to merge 1 commit into from
Closed

.h -> .hpp in classbuilder #999

wants to merge 1 commit into from

Conversation

Yanpas
Copy link
Contributor

@Yanpas Yanpas commented Apr 16, 2016

HPP stands for C++ and has better syntax highlight support in geany

HPP stands for C++ and has better syntax highlight support in geany
@codebrainz
Copy link
Member

Seems kind of arbitrary to use .hpp over the number of other extensions people use for C++ headers. Likely .h was chosen because it's the most common extension for C++ headers, at least historically.

If you remove the *.h from the C key in filetype_extensions.conf it will treat them as C++ files and you'll get proper highlighting and symbols for .h files. I do this here and it works great for both C and C++ headers, except that it wrongly highlights namespace and class and such in C headers, but I never use those in plain C headers anyway.

@b4n
Copy link
Member

b4n commented Apr 16, 2016

I agree with the OP that we should use a real C++-specific header extension. C++ using .h for its header was a really bad idea IMO, because it's not the same, although it's similar, creating mass confusion and a lot of subtle bugs everywhere.

Sure, we probably should do everything we can to support C++ headers using a .h extension out of the box, but we probably shouldn't spread its usage even more. I'd love for the next C++ standard to deprecate the .h extension or even better, remove it :) It wouldn't mean much, but still.

So, LGBI for me.

@codebrainz
Copy link
Member

@b4n I agree it's sub-optimal, but .h still is the most widely used extension for C++ headers, the same as if we had an Objective-C class generator, it would auto-type .h for the header filename, since that's what people tend to use most often.

Besides, the user can easily type pp after the .h in the GUI before creating the class, and the file will be named like that, it's only an auto-filled default.

@codebrainz
Copy link
Member

Another alternative, which I actually don't like, but is valid, would be to have the default use no extension at all, which is probably the 2nd most common for C++ headers files. The class generator could insert a // -*- C++ -*- or whatever comment so Geany would recognize it.

@elextr
Copy link
Member

elextr commented Apr 16, 2016

DO NOT USE .h FOR C++ WORST IDEA BJARNE EVER HAD :)

Agree with OP .hpp is reasonably common, and well, we have to pick something, unless "somebody" is going to add a setting to classbuilder, I would say use .hpp until then.

LGBI

[Edit: and of course it matches the use of .cpp for the body]

@codebrainz
Copy link
Member

we have to pick something

The sort of default would be .h, no? I agree it's stupid that C++ and Obj-C re-use this extension for the same purpose, but it's a reasonable default. It's not like anyone who cares can't just type 2 characters in the GUI textbox to use their preference.

In a perfect world there would be a real filetype for C++ header files and class builder could use the default extension, but at present, the current .h extension is completely reasonable..

That being said, I don't really care, I just think it's arbitrary to use .hpp over any of the other common extensions (or lack thereof) for C++ headers.

@elextr
Copy link
Member

elextr commented Apr 17, 2016

I just think it's arbitrary to use .hpp over any of the other common extensions (or lack thereof) for C++ headers.

Yes, its arbitary, so lets pick the arbitary one that gives US least problems, and which matches the .cpp body default.

@codebrainz
Copy link
Member

so lets pick the arbitary one that gives US least problems

Technically .h gives US least problems as it requires nothing to be done :)

In any case, whatever you guys think is best, it's as trivial to delete two characters from the filename as it is to add them, and I don't personally use the C++ class generator anyway.

@b4n b4n added enhancement classbuilder Related to the buil-in ClassBuilder plugin labels Apr 29, 2016
@b4n b4n self-assigned this Apr 29, 2016
@b4n b4n added this to the 1.28 milestone Apr 29, 2016
@b4n b4n closed this in a5a47da Apr 29, 2016
@b4n
Copy link
Member

b4n commented Apr 29, 2016

Cheery-picked and reworded as a5a47da, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
classbuilder Related to the buil-in ClassBuilder plugin enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants