From 5a0660f513e008192860dc71988e561386c5ecdb Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 27 Dec 2007 21:36:44 -0600 Subject: Brief note about code style. --- www/code.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'www') diff --git a/www/code.html b/www/code.html index 47fe6cdb..f92fcc77 100644 --- a/www/code.html +++ b/www/code.html @@ -1,5 +1,20 @@ +

Code style

+ +

Toybox source is formatted to be read with 4-space tab stops. Each file +starts with a special comment telling vi to set the tab stop to 4. Note that +one of the bugs in Ubuntu 7.10 broke vi's ability to parse these comments; you +must either rebuild vim from source, or go ":ts=4" yourself each time you load +the file.

+ +

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.

+

Infrastructure:

The toybox source code is in three directories. The top level directory -- cgit v1.2.3