Skip to content

Rs-incform: clarify what a relative path is and offer implementation suggestion #2272

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JohnC32
Copy link

@JohnC32 JohnC32 commented Apr 18, 2025

The Prefer the quoted form of #include for files relative to the including file and the angle bracket form everywhere else is nice. This pull request is to clarify what relative path is, which then makes it very easy to enforce:

  • Add and example clarifying that #include "utilities.hpp" or #include "../module1/utilities.hpp" can resolve to same file and are both relative.

  • With this clarification, enforcement becomes very easy because compilers can report the absolute path of the file being reference.

…suggestion

- Add and example clarifying that #include "utilities.hpp" or #include "../module1/utilities.hpp"
  can resolve to same file and are both relative.

- With this clarification, enforcement becomes very easy because compilers can report the absolute
  path of the file being reference.
@@ -19629,9 +19629,18 @@ Failing to follow this results in difficult to diagnose errors due to picking up

Library creators should put their headers in a folder and have clients include those files using the relative path `#include <some_library/common.h>`

##### Project Example

Consider a project with modules where src/module2/foo.cpp is using src/module1/utilities.hpp:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you're referring to the C++ language feature 'modules', so this is a poor choice of wording.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. I updated it to use the more generic term component (a modular, self-contained unit of software that encapsulates specific functionality). Components may be built into .so/.dll's and linked or loaded by the main executable. Alternatively, all sources of multiple components can be compiled into one executable. Should I a definition of component to be super clear, or is the term component enough?

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

Successfully merging this pull request may close these issues.

2 participants