[crossfire] [Crossfire-cvs] SF.net SVN: crossfire: [8406] client/trunk/gtk-v2/src/config.c
Andreas Kirschbaum
kirschbaum at myrealbox.com
Sun Feb 10 06:04:21 CST 2008
Crossfire CVS repository messages. wrote:
> Revision: 8406
> http://crossfire.svn.sourceforge.net/crossfire/?rev=8406&view=rev
> Author: kbulgrien
> Date: 2008-02-09 23:21:50 -0800 (Sat, 09 Feb 2008)
>
> Log Message:
> -----------
> - Reformat LOG() calls to break long lines.
[...]
> + LOG(LOG_WARNING, "config.c::load_defaults",
> + "Ignoring iconscale value read from gdefaults2 file.\n"
> + "Invalid iconscale range (%d), valid range for -iconscale "
> + "is 25 through 200", want_config[CONFIG_ICONSCALE]);
I'd like to question these changes. Background is that I often use grep
to find messages or uses of variable names. Such wrapped lines make this
process very inefficient:
- You are never sure if some occurrences are missing from the result
set. For example, a "grep 'for -iconscale is'" will not find the
above example.
- The grep output is not very useful because it lacks context. For
example, a "rgrep want_config gtk-v2" returns
[...]
gtk-v2/src/config.c: if (want_config[CONFIG_MAPSCALE]< 25 || want_config[CONFIG_MAPSCALE]>200) {
gtk-v2/src/config.c: "is 25 through 200", want_config[CONFIG_MAPSCALE]);
gtk-v2/src/config.c: want_config[CONFIG_MAPSCALE] = use_config[CONFIG_MAPSCALE];
[...]
This is not very helpful -- you have to check the source to find out
what this "25..200" range means in this context.
Using unwrapped lines, the whole LOG() statement would have been
printed. This almost always gives enough information to quickly
decide which lines belong to the issue I'm working on.
The only (slight) advantage of such wrapped lines I can see is when
using a text editor not being able to automatically wrap long lines.
I think the disadvantages of wrapped lines outnumber the benefits.
Therefore I propose to not normally wrap long lines rather than fixing
editor shortcomings with source code formatting.
Of course, there are exceptions for the "do not wrap line" rule:
extremely long or repetitive expressions for example. Generally, I'd
prefer rewriting very long lines into multiple simpler statements using
suitably named temporary variables over wrapping.
More information about the crossfire
mailing list