-
Notifications
You must be signed in to change notification settings - Fork 17
DOC: Add guideline on using a backslash as line continuation character #232
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
base: main
Are you sure you want to change the base?
DOC: Add guideline on using a backslash as line continuation character #232
Conversation
Follow-up to ITK pull request InsightSoftwareConsortium/ITK#3713 commit InsightSoftwareConsortium/ITK@69151c3 "STYLE: Remove backslash + indent from literals, to avoid unwanted spaces"
|
@N-Dekker, I was unable to write to your branch, so I created this new PR with the recommended updates. |
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.
Pull request overview
This pull request adds a new coding style guideline about using backslashes as line continuation characters in C++ code. The guideline warns about readability issues and unintended consequences when using backslashes, particularly in comments and multi-line string literals.
Changes:
- Added a new "Backslashes" section to the coding style guide
- Provided concrete examples showing problematic backslash usage and better alternatives
- Established that backslashes are discouraged in standard C++ code but allowed in preprocessor macros
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| \small | ||
| \begin{minted}[baselinestretch=1,fontsize=\footnotesize,linenos=false,bgcolor=ltgray]{cpp} | ||
| // Wil we go to sleep or not? \ |
Copilot
AI
Jan 17, 2026
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.
Typo in the code comment: "Wil" should be "Will".
| // Wil we go to sleep or not? \ | |
| // Will we go to sleep or not? \ |
| Backslashes are allowed when defining a lengthy preprocessor macro definitions to allow for | ||
| improved readability when it spans multiple lines. |
Copilot
AI
Jan 17, 2026
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.
Grammar issue: "macro definitions" is redundant when preceded by "preprocessor macro". Either use "preprocessor macro definitions" or "macros" (removing "definitions"), or simply "lengthy preprocessor macros".
| Backslashes are allowed when defining a lengthy preprocessor macro definitions to allow for | |
| improved readability when it spans multiple lines. | |
| Backslashes are allowed when defining lengthy preprocessor macros to allow for | |
| improved readability when they span multiple lines. |
| \end{minted} | ||
| \normalsize | ||
| The use of a backslash as line continuation character is discouraged in standard c++ code blocks. |
Copilot
AI
Jan 17, 2026
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.
Inconsistent capitalization: "c++" should be "C++" to match the capitalization used elsewhere in the document (see line 3267 where "C++" is correctly capitalized).
| The use of a backslash as line continuation character is discouraged in standard c++ code blocks. | |
| The use of a backslash as line continuation character is discouraged in standard C++ code blocks. |
Replace #190 with recommendations implemented.
Follow-up to ITK pull request
InsightSoftwareConsortium/ITK#3713 commit
InsightSoftwareConsortium/ITK@69151c3
"STYLE: Remove backslash + indent from literals, to avoid unwanted spaces"