The \e escape sequence

Ian Lance Taylor ian@wasabisystems.com
Wed Dec 31 19:28:00 GMT 2003


Andrew Cagney <cagney@gnu.org> writes:

> > The \e escape sequence is a GCC extension.  Its unconditional use in
> > charset.c has some interesting consequences if you use a different
> > compiler.  With the Sun compiler (on Solaris SPARC) the \e in the
> > following bit of code gets translation into a plain e:
> > static char represented[] = "\a\b\e\f\n\r\t\v";
> > As a result, GDB will start escaping e's in its output, for example:
> > (gdb) p /c 101
> > $1 = 101 '\e'
> > which leads to disaster in the testsuite.
> > So what should we do?  Simply leaving out '\e' seems the best we can
> > do if we don't compile GDB with GCC.  However, this still leads to a
> > few failures in the testsuite where we (more or less) explicitly test
> > for the '\e' escape.
> > Thoughts?
> 
> What's ISO C 90 got to say about it (I gather it isn't part of that
> version of ISO C).  If it isn't then it shouldn't be used or tested
> (except barely maybe in a GCC specific test).

The \e escape sequence is not defined by any version of ISO C.  It is
a pure gcc extension.  I think that programs which use it are
undefined according to the standard, as the standard reserves
backslash followed by a lower case character for future
standardization.

Ian



More information about the Gdb mailing list