Quoting Christian Biere <[EMAIL PROTECTED]> from ml.softs.gtk-gnutella.devel:
:Alex Bennee wrote:
:> Maybe we should remove that rule and insist on braces all the time?
:
:Maybe.

I don't like to write:

        if (cond) {
                return;
        }

or

        if (cond) {
                call();
        }

or

        if (cond) {
                a = b;
        }

In Perl, the {} are necessary on if statements, that is you MUST write
it like the above.  BUT...

Perl has a postfix "if" condition, so the above simple statements can be
written:

        return if cond;
        call() if cond;
        a = b if cond;

Which is why I don't mind that the braces be mandatory because I will always
write the latter form in Perl.

In C, since there is no postfix "if" and "unless", there is no question
about it.  We must write that with a prefix "if", like:

        if (cond)
                return;

        if (cond)
                call();

        if (cond)
                a = b;

Mistakes do happen, as the current bug shows.  But mistakes can always
happen anyway, so the fact it happened here due to a careless editing
(no blame, I have done it too on occasions) should not be a reason to make
it mandatory for code to look ugly.

Raphael

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Gtk-gnutella-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtk-gnutella-devel

Reply via email to