On Feb 21, 2011, at 8:53 AM, Björn Winckler wrote:
> No specific reason that I can remember (or think of). However, I'd rather
> avoid changing code unless there is a real problem with it.
>
> Björn
Ah, that's too bad. I understand not wanting to fix what isn't considered
broken, but I'd like to make a small attempt to persuade you reconsider. Here
are three reasons why I think it's a good idea:
1. A large switch statement is more efficient than an
equivalent if-else if ladder (O(1) vs. O(n)).
2. Debugging a large switch statement is much less tedious
than the if-else ladder, which, unless you know which
branch you want ahead of time, requires either a lot of
stepping, or a lot of searching for the right branch to
in which to set a temporary breakpoint.
3. As I previously mentioned, using the enum as a type
rather than an int allows the debugger to display the
mnemonic rather than a cryptic integer value. In
addition, compliers often offer warnings for missing
enum values when an enumeration is used as the
condition for a switch (e.g. gcc's –Wswitch-enum), as
well as warnings for values not in the enumeration.
2 and 3 are things that make it easier for people new to the code base (like
me) to trace and begin to understand the complex coordination between MacVim
and Vim. I think the benefits outweigh the risks for this minor change.
Will you reconsider?
- David
--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php