GnuCash developer documentation
Conrad Canterford
conrad@mail.watersprite.com.au
24 Nov 2002 10:19:40 +1100
On Sun, 2002-11-24 at 01:55, Matthew Vanecek wrote:
> re coding style, how's this:
Can I make one minor modification to this? (I believe this is consistent
with current style in most of the code anyway)
Replace:
> if () {
> something;
> } else {
> something else;
> }
with:
if ()
{
something;
}
else
{
something else;
}
(and the equivalent in all other situations).
Yes, its more spread out, but I find it much easier to scan the code for
{'s and }'s in a particular column when trying to find the end of a
if/else block then I do looking for the words.
Also (although it is perhaps considered bad form) the following code
would be obviously correct on a quick scan, whereas using the above
scheme, I would have to stop and check for the non-existence of the
opening { to confirm that it was correct.
if()
something();
else
{
something else;
}
> I like 4 spaces for indents
I prefer two, but that's just personal habit.
> I have seen flamefests about this type of thing before, and it's really
> not as important as all that--it just helps make the code easier to read
> when you have a standard and published style utilized across all the
> code.
And this was decided a couple of years ago, although I don't think it
ever got documented (the documentation was the code... :-)).
I'm not sure (and have no opinion at this point) on the appropriate
style for scheme. I have not done much tinkering with the scheme side of
things, so I've never really bothered to remember how its set up. I do
remember that I found it rather confusing last time I looked.
Conrad.
--
Conrad Canterford (conrad@mail.watersprite.com.au)
Water Sprite Pty Ltd | url - http://www.watersprite.com.au/
GPO Box 355, | - Australian Tour and Event Management (ATEM)
Canberra, ACT 2601 | - Ticketing Division.
Mobile: +61 402 697054 | - Catering Services Division.