Closed Stapelzeiger closed 10 years ago
If we decide that this is the way we want to do extern "C"
, this should go into the coding style. What does the rest of the team think ?
I would say it depends on what we expect the final project to look like.
If the code base is going to be pretty much mixed C/C++, then extern "C" in all the headers is the way to go. In principle, this is the solution I would favor (and thus the pull request is okay by me)
However, if only a minority of files are going to be C++, then we might assume that those are the only ones that would need to specify extern "C" on includes and Antoine's solution could be okay.
Well there will probably be two kind of C++ files :
And maybe C++ could also be an option for our own codebase. (only a very restricted subset with strong usage guidelines of course) I'm for putting the extern C declaration in the headers.
Then should we put it in all headers ?
Yes
Okie, I will put this in the coding style then.
I don't know what are the "good practices" on that. So far I have been doing it in the cpp file : https://github.com/cvra/platform-abstraction/blob/8a687dd3881ee2fccf8f5ea0ffbfb01b34c634eb/tests/criticalsection_mock_test.cpp#L6-8