GNU coding standards: Difference between revisions

Content deleted Content added
m Task 70: Update syntaxhighlight tags - remove use of deprecated <source> tags
Comments: add subsection on best practices when splitting long lines, in particular with conditional statements
Line 49:
 
As a general principle, [[GNU Emacs]] can be considered{{by whom|date=September 2016}} a reliable authority on the GNU code formatting style. As such, it is desirable{{according to whom|date=September 2016}} that any piece of code that looks ugly<!---Opinion?---> when indented by Emacs is changed into a more Emacs-friendly form—for example, by inserting additional parentheses.
 
===Splitting Long Lines===
"When you split an expression into multiple lines, split it before an operator, not after one."<ref>{{Cite web|url=https://www.gnu.org/prep/standards/standards.html#Formatting|title=GNU Coding Standards|website=www.gnu.org|language=en|access-date=2020-11-29}}</ref>
 
For example:
<syntaxhighlight lang="c">
if (foo_this_is_long && bar > win (x, y, z)
&& remaining_condition)
</syntaxhighlight>
 
 
==Comments==