bug-indent
[Top][All Lists]
Advanced

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

[Bug-indent] Re: indent bug with formatting in " "


From: David Ingamells
Subject: [Bug-indent] Re: indent bug with formatting in " "
Date: Wed, 10 Oct 2001 22:09:42 +0200

Mike,
I have just taken over as the maintainer of indent.

There seem to be several reports of the error you encountered so it seems a 
good place for me to start. I will produce a solution for this, but I 
recommend that you follow the suggestion that Carlo made with one important
modification, namely that each line in the string should end with \n, e.g.

char *format = "%c %c %c\n"
                        "%c %c %c\n"
                         "%c %c %c\n";

This works with ANSI C compilers because the ANSI standard says that two
consecutive strings separated only by white space should be joined into one 
string. Thus the above statement is equivalent to 

char *format = "%c %c %c\n%c %c %c\n%c %c %c\n";

I recommend this because:

1) the code layout is much cleaner.
2) there are no hidden control characters (e.g. the newline) in the string.

Please note the new mail address for posting bugs (or comments, suggestions, 
etc.)

I'll let you know when I have a new release, just bear with me while I find 
my way around the code.

Regards,

David Ingamells.

On Saturday 22 September 2001  3:37 pm, you wrote:
> I believe I've found a bug with indent. To email me reply to this
> address (address@hidden) as I do not subscribe to this mailing
> list. I am running GNU indent 2.2.6, by the way, which came with Debian
> Woody...
>
> I have been doing stuff like this....
>
> ---------------------
> #include <stdio.h>
>
> int main()
> {
> char *format = "\
> %c %c %c
> %c %c %c
> %c %c %c\n";
>
> printf(format, '1', '2', '3', '4', '5', '6', '7', '8', '9');
> }
> ----------------------
>
> i like to make a nice template like that for formatting output.
>
> however, running "indent testing.c" gives me:
> indent: testing.c:6: Warning:Unterminated string constant
> indent: testing.c:8: Warning:Unterminated string constant
>
> and then it screws up my file like this:
>
> ----------------------
> #include <stdio.h>
>
> int main ()
> {
> char *format = "\
> %c %c %c % c % c % c % c % c % c \ n "; printf (format, '1',
> /* ok you get the idea */
> -----------------------------
>
> which is not correct.
> indent doesn't get multiline string constants basically.
>
> It's entirely possible that I just don't know what I'm talking about
> here, as I am very new to this stuff (in fact I was working on my first
> non-completely-trivial C program when I discovered this). So if this is
> in fact not a bug just send me on my merry way.



reply via email to

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