This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: concatenating string literals


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]