=head1 DESCRIPTION
-Please use these standards while doing programming for GNU LilyPond
+We use these standards while doing programming for GNU LilyPond. If
+you do some hacking, we appreciate it if you would follow this rules,
+but if you don't, we still like you.
Functions and methods do not return errorcodes, but use assert for
checking status.
-- Geoffrey James, "The Tao of Programming"
+
+=head2 LANGUAGES
+
+C++, /bin/sh and python are preferred. Perl is not.
+
=head2 FILES
Definitions of classes that are only accessed via pointers
in emacs:
- (add-hook 'c-mode-hook
- '(lambda ()(setq c-basic-offset 4)))
-
-
(add-hook 'c++-mode-hook
- '(lambda() (c-set-style "Stroustrup")
+ '(lambda() (c-set-style "gnu")
)
)
This_is_a_class
AClass_name (for Abbreviation_class_name)
-=head2 DATA MEMBERS
+=head2 MEMBERS
Class::member()
Type Class::member_type_
+ Type Class::member_type()
the C<type> is a Hungarian notation postfix for C<Type>. See below
+=head2 MACROS
+
+Macros should be written completely in uppercase
+
+The code should not be compilable if proper macro declarations are not
+included.
+
+Don't laugh. It took us a whole evening/night to figure out one of
+these bugs.
=head2 BROKEN CODE
Presence of these methods usually imply that it is not feasible to this
via a constructor
*/
- add( .. )
+ add (..)
/// replace some data of *this
- set( .. )
+ set (..)
+
+=head2 Constructor
+
+Every class should have a default constructor.
+
+Don't use non-default constructors if this can be avoided:
+
+ Foo f(1)
+
+is less readable than
+
+ Foo f;
+ f.x = 1
+
+or
+ Foo f(Foo_convert::int_to_foo (1))
+
+
=head1 HUNGARIAN NOTATION NAMING CONVENTION
our source code, you also notice very few comments. Hungarian
gives us the ability to go in and read code..."
-
Wow! If you use Hungarian you don't have to document your software!
Just think of the hours I have wasted documenting while this "silver bullet"
-existed. I feel so stupid and ashamed!
+existed. I feel so stupid and ashamed! [Didn't MMM-Brooks say `There is
+no silver bullet?' --HWN]
+
=head2 Disadvantages
use non-ambiguous postfixes C<identifier_name_type_modifier[_modifier]>
+=item *
+
+There is no need for Hungarian if the scope of the variable is small,
+ie. local variables, arguments in function definitions (not
+declarations).
+
=back
Macros, C<enum>s and C<const>s are all uppercase,
=head2 Modifiers
The following types modify the meaning of the prefix.
-These are precede the prefixes:
+These are preceded by the prefixes:
=over 5
=item C<c>
-const. Note that the proper order C<Type const> i.s.o. C<const Type>
+const. Note that the proper order is C<Type const> i.s.o. C<const Type>
=item C<C>
=over 5
+=head2 Adjective
+
+Adjectives such as global and static should be spelled out in full.
+They come before the noun that they refer to, just as in normal english.
+
+foo_global_i: a global variable of type int commonly called "foo".
+
+static class members do not need the static_ prefix in the name (the
+Class::var notation usually makes it clear that it is static)
+
=item C<loop_i>
Variable loop: an integer
Generally default arguments are taboo, except for nil pointers.
+The naming convention can be quite conveniently memorised, by
+expressing the type in english, and abbreviating it
+
+ static Array<int*> foo
+
+C<foo> can be described as "the static int-pointer user-array", so you get
+
+ foo_static_l_arr
+
+
+
+
=head1 MISCELLANEOUS
For some tasks, some scripts are supplied, notably creating patches, a