coding.html revision 9821041d63289a415ace7e82d4c232ca05f72ce1
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncAn ANSI standard C compiler and library are assumed. Feel free to use any
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncANSI C feature.<P>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncGiven a reasonable set of things to warn about (e.g. -W -Wall for gcc), the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncgoal is to compile with no warnings.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncAll source files should have a copyright. The copyright year(s)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncshould be kept current. The files and the copyright year(s) should be
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUse tabs. Spaces are only allowed when needed to line up a continued
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncexpression. In the following example, spaces used for indentation are
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncindicated with "_":
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync printf("this is going to be %s very long %s statement\n",
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync _______"a", "printf");
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync<H4>Line Length</H4> Lines should not be longer than 80 characters,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsynceven if it requires violating the indentation rules to do so.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncComments should be used anytime they improve the readability of the code.<P>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncComments may be single-line or multiline. A single-line comment should be
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncat the end of the line of there is other text on the line, and should start
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncin the same column as other nearby end-of-line comments. The comment
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncshould be at the same indentation level as the text it is referring to.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncMultiline comments should start with "/*" on a line by itself. Subsequent
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsynclines should have " *" lined-up with the "*" above. The end of the comment
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncshould be " */" on a line by itself, again with the "*" lined-up with the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncone above. Comments should start with a capital letter and end with a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Private variables.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync static int a /* Description of 'a'. */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync static int b /* Description of 'b'. */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync static char * c /* Description of 'c'. */
The first file to be included must be config.h.
should be used for generic variables (e.g. iteration counters, array