Jose' Matos wrote:

> Hi,
> am I the only one using FC3 with the latest gcc?

If by "latest" you mean whatever ships with FC3, updated with up2date, 
then no, you're not the only one. That's my home system too.

> After I bit of research I found the culprit:
> 
> Index: src/insets/insetcommandparams.C
> ===================================================================
> RCS file:
> /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcommandparams.C,v
> retrieving revision 1.13 diff -u -p -r1.13 insetcommandparams.C
> --- src/insets/insetcommandparams.C     3 Apr 2004 08:37:10 -0000      
> 1.13
> +++ src/insets/insetcommandparams.C     5 May 2005 15:08:54 -0000
> @@ -47,7 +47,7 @@ void InsetCommandParams::scanCommand(str
> 
>         for (string::size_type i = 0; i < cmd.length(); ++i) {
>                 char c = cmd[i];
> -               char b = cmd[i-1];
> +               char b = i? cmd[i-1]: 0;
>                 if ((state == CMDNAME && c == ' ') ||
>                     (state == CMDNAME && c == '[') ||
>                     (state == CMDNAME && c == '{')) {
> 
>   Is this the right fix?

Urggggs. Doesn't cmd[-1] mean cmd[cmd.length()-2]. Some nasty c-ism?

Anyway, it's certainly nasty. Looking at the code, wouldn't it be nicer to 
move b here (and make it const):

    for (string::size_type i = 0; i < cmd.length(); ++i) {
        char const c = cmd[i];
        ...
        switch (state) {
        case WS: {
            char const b = i ? cmd[i-1] : '\0';
            ...
        }
        }
    }

-- 
Angus

Reply via email to