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

Source code arrangement isn't idiomatic #67

Open
joshuaehill opened this issue Sep 22, 2018 · 0 comments
Open

Source code arrangement isn't idiomatic #67

joshuaehill opened this issue Sep 22, 2018 · 0 comments

Comments

@joshuaehill
Copy link
Contributor

I've never encountered a project with (otherwise standard) functions implemented within header files. Traditionally, headers contain only information that must be shared between compilation units (function signatures, type definitions, etc). In some settings, header files contain functions, but these are (charitably) to deal with language quirks, like the handling of "inline" functions in C. It's also somewhat common to see very simple object methods defined directly within header files.

The existing structure places the bulk of the code in header files.

There are some software engineering reasons to avoid this arrangement; compilation units (the .cpp files) provide for limited variable scoping, which provides some degree of separation between the various compilation units.

In the present arrangement you have exactly one compilation unit per binary, so you miss out on that compiler-enforced abstraction interface.

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

No branches or pull requests

1 participant