Do you use .h or .hpp ending for header files?
Do you use .h or .hpp ending for header files?
I'm interested why I don't see that extension, does .hpp so "bad" nobody uses it? The only places I've seen it is with my friend's library and FMOD Ex..
I'm really interested how many of you actually use it and if not why not? Is it just a habit? You just hate typing 2 more characters, what's the reason?
I'm using .h for my project just because I didn't knew of .hpp until few months before I met irrlicht which uses .h only so I stayed with it..
Unless I'll hear anything intimidating I think I'll changed'em all to .hpp..
P.S
I understood .h is for C and .hpp is for C++.. Am I wrong or is it just another standard.
I'm really interested how many of you actually use it and if not why not? Is it just a habit? You just hate typing 2 more characters, what's the reason?
I'm using .h for my project just because I didn't knew of .hpp until few months before I met irrlicht which uses .h only so I stayed with it..
Unless I'll hear anything intimidating I think I'll changed'em all to .hpp..
P.S
I understood .h is for C and .hpp is for C++.. Am I wrong or is it just another standard.
I'm using .h as well. not really sure what's the difference though.
My company: http://www.kloena.com
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
-
- Posts: 362
- Joined: Sun Dec 16, 2007 9:25 pm
I use .h...
but it really doesn't matter
(Can't you use anything you want? Such as .lol, because you can then just include whatever.lol --although this would probably confuse a ton of people)
but it really doesn't matter
(Can't you use anything you want? Such as .lol, because you can then just include whatever.lol --although this would probably confuse a ton of people)
Post this userbar I made on other websites to show your support for Irrlicht!
http://img147.imageshack.us/img147/1261 ... wernq4.png
http://img147.imageshack.us/img147/1261 ... wernq4.png
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Yes, #include "foo.lol" is perfectly valid, as is #include "foo".
I don't use .hpp but I actually do think that in theory if you use .cpp then you should also use .hpp (in as much as any file extension is a good thing).
That's because the verbatim nature of #include makes the distinction between "source" and "header" files in C/C++ a matter of convention. All C or C++ source is "source", and any individual C or C++ file (regardless of its extension) should be compilable on its own. It should not[1] rely on any "source" file to include anything else beforehand.
Very occasionally I do put together special build targets that build every "include" file in my projects individually, using an appropriate compiler switch to force compilation. This verifies that each "include" file includes everything necessary for it to compile, which makes them a lot more portable and saves some unnecessary over-including of things in "source" files.
So once you get used to viewing "header" files as just another source file, .hpp makes a lot of sense. It's really just a bad habit from C days that keeps me using .h and I may very well be tempted to script a find-and-replace on my projects on the back of this.
Or I may just eat some pie instead. It could go either way.
[1] In general, but I make an exception for #define switches that alter behaviour.
I don't use .hpp but I actually do think that in theory if you use .cpp then you should also use .hpp (in as much as any file extension is a good thing).
That's because the verbatim nature of #include makes the distinction between "source" and "header" files in C/C++ a matter of convention. All C or C++ source is "source", and any individual C or C++ file (regardless of its extension) should be compilable on its own. It should not[1] rely on any "source" file to include anything else beforehand.
Very occasionally I do put together special build targets that build every "include" file in my projects individually, using an appropriate compiler switch to force compilation. This verifies that each "include" file includes everything necessary for it to compile, which makes them a lot more portable and saves some unnecessary over-including of things in "source" files.
So once you get used to viewing "header" files as just another source file, .hpp makes a lot of sense. It's really just a bad habit from C days that keeps me using .h and I may very well be tempted to script a find-and-replace on my projects on the back of this.
Or I may just eat some pie instead. It could go either way.
[1] In general, but I make an exception for #define switches that alter behaviour.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
I use .h most of the times, .hpp sometimes, but you should use .hpp when your header is part of a c++ obj and .h when it's part of a c obj. Of course, .h is shorter and since people see the .cpp associated, they get it's c++. Also, sometimes with libraries and dll, the header is proper c while the body is c++. But since only the .h is distributed, it's compatible c/c++
When i said "if i creating the name of file" -- i meant that if naming file by my self (not another member of the team (of project)).MasterGod wrote:I don't know how it is with other compilers but VC also generate .h not .hpp.greenya wrote:i use .h if i creating the name of file
Well, you said "if", which compiler do you use then that generate .hpp files?
And also: i do not use generating-features of IDE -- i always specify name with extension while creating new file.
p.s.: I'm using MS VS 2005 TS.
p.p.s.: If you talking about IDE while saying "which compiler do you use then that generate .hpp files?" -- i never met IDEs that generates .hpp extensions if you ask it to.
-
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
From the Boost FAQ:
"Why do Boost headers have a .hpp suffix rather than .h or none at all?
File extensions communicate the "type" of the file, both to humans and to computer programs. The '.h' extension is used for C header files, and therefore communicates the wrong thing about C++ header files. Using no extension communicates nothing and forces inspection of file contents to determine type. Using '.hpp' unambiguously identifies it as C++ header file, and works well in actual practice."
I really like the extension '.lol', btw.
"Why do Boost headers have a .hpp suffix rather than .h or none at all?
File extensions communicate the "type" of the file, both to humans and to computer programs. The '.h' extension is used for C header files, and therefore communicates the wrong thing about C++ header files. Using no extension communicates nothing and forces inspection of file contents to determine type. Using '.hpp' unambiguously identifies it as C++ header file, and works well in actual practice."
I really like the extension '.lol', btw.
-
- Posts: 362
- Joined: Sun Dec 16, 2007 9:25 pm
Yeah, .lol pwns
Anyway, I'm going to use .hpp from now on.. It's easier to understand.. I think everyone should use it from now on.
Anyway, I'm going to use .hpp from now on.. It's easier to understand.. I think everyone should use it from now on.
Post this userbar I made on other websites to show your support for Irrlicht!
http://img147.imageshack.us/img147/1261 ... wernq4.png
http://img147.imageshack.us/img147/1261 ... wernq4.png