From ca73392a472f5425ea5059e05c82f104da10ce9d Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 19 May 2014 18:24:35 -0500 Subject: Fluff out the coding style section, but the result was a bit big for the start of code.html, so move it to design.html. --- www/code.html | 15 +++------ www/design.html | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 10 deletions(-) diff --git a/www/code.html b/www/code.html index a5ffa155..faa718ca 100755 --- a/www/code.html +++ b/www/code.html @@ -14,15 +14,9 @@ This helps code auditing and thus reduces bugs. That said, sometimes being more explicit is preferable to being clever enough to outsmart yourself: don't be so terse your code is unreadable.

-

Toybox source uses two spaces per indentation level, and wraps at 80 -columns.

- -

Gotos are allowed for error handling, and for breaking out of -nested loops. In general, a goto should only jump forward (not back), and -should either jump to the end of an outer loop, or to error handling code -at the end of the function. Goto labels are never indented: they override the -block structure of the file. Putting them at the left edge makes them easy -to spot as overrides to the normal flow of control, which they are.

+

Toybox has an actual coding style guide over on +the design page, but in general we just +want the code to be consistent.

Building Toybox

@@ -1156,7 +1150,7 @@ Linux kernel's Documentation/kbuild/kconfig-language.txt

Directory generated/

All the files in this directory except the README are generated by the -build. (See scripts/make.sh)

+build. (See scripts/make.sh)