2
<title>Appendix</title>
5
<title>Code Style</title>
8
I know any discussion of coding styles leads to strong opinions,
9
so I'll state simply I follow the <ulink type="http"
10
url="http://www.gnu.org/prep/standards/standards.html">GNU
11
Coding Standards</ulink>. Where there is some flexibility as to
12
the location of braces, I prefer mine on the end of a line when
13
using an <emphasis>if</emphasis>, <emphasis>while</emphasis>, or <emphasis>do</emphasis>
14
statement. I find this more compact style easier to read and
15
parse by eye. I'm also a big fan of always using
16
braces around <emphasis>if</emphasis> statements, even if they're one
21
Here's my tweaked style settings for <emphasis>Emacs</emphasis>, the one
22
true editor to rule them all.
26
'((c-tab-always-indent . t)
28
(c-hanging-braces-alist . (
46
(inexpr-class-close)))
47
(c-hanging-colons-alist . ((member-init-intro before)
51
(access-label after)))
65
;; no automatic newlines after ';' if following line non-blank or inside
66
;; one-line inline methods
67
(add-to-list 'c-hanging-semi&comma-criteria
68
'c-semi&comma-no-newlines-before-nonblanks)
69
(add-to-list 'c-hanging-semi&comma-criteria
70
'c-semi&comma-no-newlines-for-oneline-inliners)
71
; (knr-argdecl-intro . -)
72
(c-echo-syntactic-information-p . t)
74
"My GNU Programming Style")
80
Another coding consideration: comments are good! Over
81
commenting isn't good. Here is an over commented example:
84
counter++; // increment counter
87
Gnash also uses <ulink type="http"
88
url="http://www.doxygen.org">Doxygen</ulink> style
89
comments. These are processed by Doxygen when building a cross
90
reference of all the classes, and is a good way to help push
91
internals documentation from the depths of the code into
92
documentation where it can be seen by others.
96
<emphasis>Doxygen</emphasis> style comments for <emphasis>C++</emphasis> code involves
97
simply using three slashes <emphasis>///</emphasis> instead of the
98
standard two slashes <emphasis>//</emphasis> used for C++
99
comments. Here's a short comment block for the
100
<emphasis>XML::cloneNode()</emphasis> method:
103
/// \brief copy a node
105
/// Method; constructs and returns a new XML node of the same type,
106
/// name, value, and attributes as the specified XML object. If deep
107
/// is set to true, all child nodes are recursively cloned, resulting
108
/// in an exact copy of the original object's document tree.
110
XML::cloneNode(XMLNode &newnode, bool deep) {
117
The <emphasis>\brief</emphasis> keyword means that the
118
text becomes associated
119
when listing all the classes on the generated web pages. The
120
text after the blank line becomes the detailed description which
121
appears on the generated web page for that class and method.
127
<title>Shockwave Movie Opcodes</title>
130
<title>Version 5</title>
136
<title>Version 6</title>
142
<title>Version 7</title>
148
<title>Version 8</title>
154
<title>Version 9</title>