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

Remove '#ifdef __cplusplus extern "C"' sections from C sources #226

Open
saxbophone opened this issue Nov 14, 2018 · 0 comments
Open

Remove '#ifdef __cplusplus extern "C"' sections from C sources #226

saxbophone opened this issue Nov 14, 2018 · 0 comments

Comments

@saxbophone
Copy link
Owner

Chunks of code like this:

#ifdef __cplusplus
extern "C"{
#endif

are useful in C header files in allowing C++ programs to use C functions, by specifying those functions with C linkage.

However, although this is tolerable when it comes to headers, it shouldn't be used in source files. My source files aren't written with the intention of the code in them being 100% compatible with C++, so I should not put anyone under any illusion that they can be compiled with a C++ compiler (even if that might work).

TL; DR; Make it clear that the library intends to be used by C++ programs, but that the library itself should still be compiled as C.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant