You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.
Currently all the #includes for the source code are in the header files, which avoids repetition, but pollutes any users of the SDK with unnecessary dependencies and system headers, since there's no way to access the library API without the headers. Clean headers make it easier to integrate with third-party code and avoid unnecessary conflicts.
Given how C++ works, it's better to keep includes as close to the source as possible and avoid them in the header files, even if it causes repetition, since library headers can be included anywhere and pull everything along with them.
The source files (.cpp) should carry most of the includes, as they're the ones calling functions. Header files (.h) only need to include other headers for types and defines they reference.
The include/ folder should only contain header files with the library's public API (functions and classes exported by the DLL), all the others should stay in the src/ folder. The ModioC.h is a good example, as it defines nothing but the public API.
Feel free do the changes =) Just to let you know, we won't maintain this repository for much longer as we have a version 2 of the SDK that's just about to go out of the door
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Currently all the #includes for the source code are in the header files, which avoids repetition, but pollutes any users of the SDK with unnecessary dependencies and system headers, since there's no way to access the library API without the headers. Clean headers make it easier to integrate with third-party code and avoid unnecessary conflicts.
.cpp
) should carry most of the includes, as they're the ones calling functions. Header files (.h
) only need to include other headers for types and defines they reference.include/
folder should only contain header files with the library's public API (functions and classes exported by the DLL), all the others should stay in thesrc/
folder. TheModioC.h
is a good example, as it defines nothing but the public API.Tools like https://include-what-you-use.org/ can help automate this process.
The text was updated successfully, but these errors were encountered: