You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

STYLE.txt 1.2 kB

12345678910111213141516171819202122232425262728293031
  1. In general:
  2. For minor changes to a function, copy the existing formatting.
  3. When changing the style, commit that separately from other changes.
  4. For new code and major changes to a function, switch to the official json-c style.
  5. Official json-c style:
  6. Aim for readability, not strict conformance to fixed style rules.
  7. Formatting is tab based; previous attempts at proper alignment with
  8. spaces for continuation lines have been abandoned in favor of the
  9. convenience of using clang-format.
  10. Refer to the .clang-format file for details, and run the tool before commit:
  11. clang-format -i somefile.c foo.h
  12. For sections of code that would be significantly negatively impacted, surround
  13. them with magic comments to disable formatting:
  14. /* clang-format off */
  15. ...code...
  16. /* clang-format on */
  17. Naming:
  18. Words within function and variable names are separated with underscores. Avoid camel case.
  19. Prefer longer, more descriptive names, but not excessively so. No single letter variable names.
  20. Other:
  21. Variables should be defined for the smallest scope needed.
  22. Functions should be defined static when possible.
  23. When possible, avoid exposing internals in the public API.