Re: ZAP/[patch] Martin's cursor position POW


Subject: Re: ZAP/[patch] Martin's cursor position POW
From: Mike Nordell (tamlin@algonet.se)
Date: Thu Jan 25 2001 - 20:08:37 CST


Thomas Fletcher wrote:
> Actually I would even go so far as to say that what it should be is:
>
> if(lff) {
> pActiveView = lff->getCurrentView();
> } else {
> pActiveView = this;
> }
>
> (Pick your favourite bracing technique and use it) The reason is
> so that it is easier to insert debugging code without the possibility
> of messing up the ordering of the code.

I'd go even further and say that we 1) should follow the AW guidelines and
use '{' on its own line, but then I'd like to add to *always* use braces.
I've seen my share of mistakes when new developers mistake indentation for
scope (it happens) and enforcing curly braces even for one-liners. (What do
I personally do? I always use curly braces in case some one else use my
code, but I put the opening brace at the far right if possible. But this
have nothing to do with AW).
Would it become a wierd guideline if we enforced braces but mentioned that
enclosed one-liners could be enclosed by a line-trailing opening brace like
    if (foo) {
        bar();
    }

or would it make for more readable and maintainable code?

> > 2) Comments.
> >
> > This is something new that I want to suggest. I think every new
> > function that we write (at a minimum, all the XP ones) should have at
> > least a short comment, preferably for Doxygen, explaining what it
> > does. If we follow this practice, our code will soon become much
> > clearer and easier to understand (keep your fingers crossed).
> >
> > What do people think about that?

Yes. Jesper has done the dirty work and now it's hopefully gaining
accepance. If we do decide on this commenting style I'd like to see an
update ASAP to the guidelines.

But, I have one comment: When commenting functions in source code it looks
really nice with the following

//
// This function does blah blah blah
// It returns UT_FALSE on error
//
UT_Bool foo()
{ }

I.e. leading and trainling "//" on their own lines (it's a sort of an
enforced vertical whitespace, and as we all know whitespaces are good).
You'e of course free to add any number of lines to the comment as long it
contains one trainling single-line-C++-comment as its first chars.

Is it wierd?

/Mike - please don't cc



This archive was generated by hypermail 2b25 : Thu Jan 25 2001 - 20:08:33 CST