Reputation: 57119
In my project I use two libraries, v8 and boost. Boost uses the .hpp
extension for its headers, while v8 uses the .h
extension for its headers.
In the end of day, my source code starts like that:
#include "v8.h"
#include "boost/filesystem.hpp"
...
In other question I asked about this subject, the general answer was that it is okay, but I just should be consistent between names.
This code compiles well, but, coding styles/standards - is it okay? Is there any solution for this problem (like changing all .hpp
to .h
automatically somehow?)
Thanks. And sorry for those stupid questions.
Upvotes: 1
Views: 147
Reputation: 347196
Don't worry about the inconsistency, it doesn't matter. Too much time is often spent obsessing about such details, and everyone is guilty of it.
Just be consistent with your own coding standards.
You'll eventually use some 3rd party library or several that use different conventions than you. There's nothing you can do about it, and often 2 of those libraries you use will be conflicting with your standards and with each other. That's not only for include extensions, but also for naming convetions like function_that_does_something
vs FunctionThatDoesSomthing
.It's fine.
I would definitely strongly advice against trying to change someone else's library to fit into your coding standard. I.e. for example renaming boost .hpp to .h. This is a bad idea and when you want to upgrade to newer versions of the library it will be a nightmare.
Spend your time solving the problem you're solving in a more elegant way rather than worrying about details like this.
Upvotes: 3
Reputation: 881113
It's fine. Coding standards don't really come into it since you have to go with what you're given. If the v8 people only provide .h
and the boost people only provide .hpp
then, short of copying one set of files to the other choice or providing your own wrapper header files, you have few options.
Both of those option have their downsides for what is really dubious benefits, so I wouldn't concern yourself with the fact that you have to include two different file extensions.
Upvotes: 1