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]

concatenating string literals


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).  For reference, here's a bit of code descended from
lookup_symbol_aux with both options: the original code was this:

	      error ("Internal: %s symbol `%s' found in %s psymtab but not in symtab.\n\
%s may be an inlined function, or may be a template function\n\
(if a template, try specifying an instantiation: %s<type>).",

which either gets turned into this:

	      error ("Internal: %s symbol `%s' found in %s psymtab but not in symtab.\n%s may be an inlined function, or may be a template function\n(if a template, try specifying an instantiation: %s<type>).",

or this:

	      error ("Internal: %s symbol `%s' found in %s psymtab but not in symtab.\n"
		     "%s may be an inlined function, or may be a template function\n"
		     "(if a template, try specifying an instantiation: %s<type>).",

David Carlton
carlton@math.stanford.edu


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