Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 395
    • Issues 395
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Wiki
  • Tutorials
  • Coding Style

Coding Style · Changes

Page history
adding example to coding style.md authored Feb 22, 2025 by Quinten Cabo's avatar Quinten Cabo
Hide whitespace changes
Inline Side-by-side
tutorials/Coding-Style.md
View page @ 4e4ecd1d
# Blocks with 1 statement
- The body of an if condition should at preferably have brackets. If the body has just one statement you may leave out the `{}` but in that case put the statement indented on another line. Also only do this if you think it unlikely that you will add more statements to the body later.
**OK:**
```c
if (flags & STMT_BLOCK_RETURN_F)
ret = TCappendAssign (ret, ret_stmt);
if ((flags & STMT_BLOCK_RETURN_F) && !parse_error) {
BLOCK_VARDECS (ret) = vardecl;
}
```
**NOT OK:**
```c
if (flags & STMT_BLOCK_RETURN_F) ret = TCappendAssign (ret, ret_stmt);
```
\ No newline at end of file
Clone repository
  • concepts
    • Deprecated Modules
    • Globals
    • Named Tuples
    • Overloading
    • Preprocessor
    • Primitive functions
    • Runetime Representations
    • input stdin
    • phm xt
    • ref counting methods
    • type famlies
    • type patterns
  • error messages
    • Anthropomorphic error essages
    • Colored error messages
    • Empty file error
View All Pages