GnomeWiki
Tech
/
Minimalist Code Style
Edit Page
|
Page History
|
Wiki Help
Print
|
Search
:
Home
Projects
Code
Tech
Network
MediaCentre
UAV
Travel
Music
Horse Riding
Study
Games
Other Activities
Car
House
Watch
Clothing
Miscellany
WikiSandbox
edit SideBar
XHTML
Minimalist Code Style
Objective
A C coding style which:
is concise
minimizes diffs for common maintenance and refactoring tasks
is stable under automated indent tools (indent, uncrustify)
is generally independent of brace-style
easily greppable
Common Maintenance Tasks
Modify a function declaration
Modify a struct or enum
General
No horizontal alignment (this includes comment boxes)
List elements
Function parameter lists
Separate lines for:
Return and storage type
Function name
Parameters
Comma-decl style for parameters
extern
return_type_t
Function
(
int
param1
,
int
param2
,
int
param3
)
;
[$[Get Code]]
Enumerations
Mandatory last element
enum
Enumeration
{
ZEROTH
=
0
,
/**! Short description */
FIRST
=
1
,
SECOND
=
2
,
/** Mandatory last element */
LAST
}
;
[$[Get Code]]
Expressions
Separate lines for each argument
New indent for each sub-expression
if
(
booleanA
&&
booleanB
||
(
booleanC
&&
booleanD
)
)
{
}
[$[Get Code]]
Recent Changes
(All)
|
Edit SideBar
Page last modified on 18 August 2016, at 12:44 PM UTC
Edit Page
|
Page History
Powered by
PmWiki