This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: concatenating string literals
- From: Jim Blandy <jimb at redhat dot com>
- To: David Carlton <carlton at math dot stanford dot edu>
- Cc: gdb <gdb at sources dot redhat dot com>, Andrew Cagney <ac131313 at ges dot redhat dot com>
- Date: 08 Oct 2002 19:16:50 -0500
- Subject: Re: concatenating string literals
- References: <ro1lm5jukt3.fsf@jackfruit.Stanford.EDU>
David Carlton <carlton@math.stanford.edu> writes:
> I was recently working on a part of GDB that had a long string
> constant with some embedded backslash-newline pairs. Unfortunately,
> CC mode got so confused by this as to make it impossible to edit the
> file. Now, I know this is a bug in CC mode, but I don't really feel
> like fixing that; so my options are to either delete the
> backslash-newline pairs or to write each line as a separate string
> literal which will automatically get concatenated. In other words,
>
> "a\n\
> b"
>
> gets turned into either
>
> "a\nb"
>
> or
>
> "a\n"
> "b"
>
> Any opinion on which of these is preferred? I first leaned towards
> the latter, but I'm not sure that's currently done anywhere in the GDB
> sources, and the resulting code doesn't look that great (since, what
> with indentation, the long string constants typically overflow the
> lines they're on).
GDB requires ISO C now (or at least ANSI), so it's okay to use string
juxtaposition. I think using that to keep lines under 80 characters
is just fine.