C code style and coding rules

I’ve been trying to make my own C code style and coding rules approach, to be used in all my libs.

From my first coding experience till today, I changed style many times, from first STM32F4 Library to latest projects, such as ESP_AT_Lib, onewire_uart and others.

 

Code style rules are published and regularly updated on my Github account, under c_code_style repository name. Please use URL below to access website:

https://github.com/MaJerle/c_code_style

It was originally inspired by LwIP coding style with some modification. Document today covers:

  • General rules like opening brackets, tabs size, etc
  • Function syntax
  • Comments and documentation
  • Structures/Enumerations
  • Macros

In case you would add some part or modify existing, feel free to propose in repository itself.

tilz0R

Owner of this site. Application engineer, currently employed by STMicroelectronics. Exploring latest technologies and owner of different libraries posted on Github.

You may also like...

Read before commenting!

Before you make a new comment, make sure you agree with things listed below:

  • - Read post to make sure if it is already posted what you are asking for,
  • - Make sure you have the latest version of libraries used in your project,
  • - Make a clean and grammatically correct written message,
  • - Report as many details as possible, including what have you done so far,
  • - Do NOT post any code here. Use Pastebin,
  • - Do NOT post any error codes here. Use Pastebin,
  • - Specify STM32Fxxx family and used Discovery/EVAL/Nucleo or custom made board,
  • - Make sure your clock is set correct for PLL,
  • - If you are using my HAL drivers, please check this post how to start.
Comment will be deleted on breaking these rules without notification!