[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Another small problem of CC Mode

From: Alan Mackenzie
Subject: Re: Another small problem of CC Mode
Date: 12 Jan 2007 10:03:51 +0100
Date: Fri, 12 Jan 2007 10:16:15 +0000
User-agent: Mutt/1.5.9i

Hi, Guanpeng!

On Fri, Jan 12, 2007 at 09:58:31AM +0800, Herbert Euler wrote:
> Hi,
> In a file that contains C program like this:
>    extern void g(void);
>    extern void h(void);
>    int
>    f(void)
>    {
>            do {
>    #ifdef M1
>            } while (g());
>    #else
>            } while (h());
>    #endif /* M1 */
>    }

> Many functions in CC mode will behave incorrectly:
> `c-beginning-of-defun' and `c-end-of-defun' cannot go to the right
> place; `c-indent-command' cannot indent to the right column;
> `c-electric-brace' tells an error, which is not, when typing the `}'
> that finishes the function `f'; and so on.

Yes.  C is a ghastly language.  ;-)

> Of course, this is rare.  But will making CC Mode detect this
> situation and behave in a right way need much effort?

It's difficult to make Emacs's syntax stuff only see one of the "}"s.
Not impossible, just difficult.  I've been thinking about it, off and on,
for about two years now.  Fixing it would probably take more effort than
it's worth - but a mention in the "Limitation and Known Bugs" section of
the manual might be sensible.

> Thanks in advance.
> Regards,
> Guanpeng Xu

Alan Mackenzie (Ittersbach, Germany)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]