[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: c preprocessor and indent problem in c-mode?
From: |
YOUNG |
Subject: |
Re: c preprocessor and indent problem in c-mode? |
Date: |
Sun, 25 Jan 2009 18:03:26 -0800 (PST) |
User-agent: |
G2/1.0 |
On Jan 25, 4:46 pm, YOUNG <breadn...@gmail.com> wrote:
> Hi,
>
> If there is a following code, emacs does not present indent correctly.
>
> #incude <stdio.h>
>
> int main(void) {
> int a = 10;
> #ifdef AAA
> if (a == 10) {
> printf("a:%d\n", a);
> #else
> if (b == 10) {
> printf("b=10\n");
> #endif
> }
>
> #endif
> }
>
> If the curly brace is not closed before the preprocessor, emacs seems
> to confuse to make indent.
>
> Is there anyone who know this problem and how to resolve?
The code I wrote before was not completed, but this is the final one.
#include <stdio.h>
int main(void) {
int a = 10;
int b=10;
#ifdef AAA
if (a == 10) {
printf("a:%d\n", a);
#else
if (b == 10) {
printf("b=10\n");
#endif
}
}
And, as you could see, emacs seems to confuse the indent the code.