[Box Backup-dev] [PATCH] Win32 merge [05] bbackupd

Nick Knight boxbackup-dev at fluffy.co.uk
Wed Aug 9 10:29:04 BST 2006


For compilers switches are more efficient, if's and elsifs if it is the
last match then it runs them all, typically a lot of compilers compile
switch statements into jump tables (AFAIK).

-----Original Message-----
From: boxbackup-dev-admin at fluffy.co.uk
[mailto:boxbackup-dev-admin at fluffy.co.uk] On Behalf Of Chris Wilson
Sent: 09 August 2006 10:23
To: boxbackup-dev at fluffy.co.uk
Subject: Re: [Box Backup-dev] [PATCH] Win32 merge [05] bbackupd

Hi Martin,

On Wed, 9 Aug 2006, Martin Ebourne wrote:

> Why the chained elseifs? switch would be cleaner and less error prone.

I actually find elseifs easier to read. The exact condition being tested

is always at hand; there's no break/fallthrough nonsense that can easily

confuse, and indentation is not a problem.

Besides, I've done a lot of Perl coding, where switch doesn't exist, and

Java, where it's effectively useless because there are no integer=20
constants, so I'm out of the habit of using switch.

> These should be part of the same changeset that adds the code back
into
> Daemon.cpp. Then there would be no breakage and everything would be
> consistent. Prefer change based merge to file based merge. :)
>
> Notwithstanding the above, the rest of it looks fine to me.

Breaking up into separate patches. First one is at:

   svn diff -r 728:729 http://bbdev.fluffy.co.uk/svn/box/chris/merge

Whitespace fix. Please review.

Cheers, Chris.
--=20
_ ___ __     _
  / __/ / ,__(_)_  | Chris Wilson <0000 at qwirx.com> - Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer |
\ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |
_______________________________________________
Boxbackup-dev mailing list
Boxbackup-dev at fluffy.co.uk
http://lists.warhead.org.uk/mailman/listinfo/boxbackup-dev



More information about the Boxbackup-dev mailing list