Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Feature/coding conventions #544
Feature/coding conventions #544
Changes from 7 commits
c3c5772
d188dd4
7ec7c39
65750a5
b38d080
a565eff
88ea127
b688dc0
ef45f41
49ef5c2
8ed95f2
ec71872
e32f4d5
74d9c24
d2a8230
be88ea0
546490e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked into clang-format 15 and it has the following for LLVM:
which will result in STL headers being at the end of the include list, is this something that is preferred? I would recommend something like (based on LLVM configuration) this in a header or source file:
I would even set this to
Preserved
and let the developer decide, or create a customIncludeCategories
block.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally are not a fan of organizing headers manually, so I prefer adding a IncludeCategories section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, there is a case where manually organizing headers can be useful: for each .h/.c pairs, e.g., celix_bundle_cache.h(.c), always include the header file (
celix_bundle_cache.h
) in the first line of the non-comment part of the source file (celix_bundle_cache.c
) to make sure the header file is self-contained, which means it can be used alone. Self-contained header file is really nice.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-format does take into account. So when you run formatting over a
foo.c
source file and there is a include offoo.h
this will be included first.This should even be extendable with the
IncludeIsMainRegex
option, but I could not get that to work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've consistently encountered problems with this setting while developing libraries, particularly when using angle brackets (
<>
) to include header files within the library. However, these problems don't seem to occur when using double quotes (""
).E.g.:
will get reorganized in:
while, the following:
will get reorganized in:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I purpose to not regroup includes header for now.
I will leave this as comments, so that it can be used if desired on case per case basis.
If needed we can revisit this at a later stage.