This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Support for Pascal strings
- To: Stan Shebs <shebs at apple dot com>, "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Subject: Re: PATCH: Support for Pascal strings
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Wed, 20 Jun 2001 15:21:54 -0700
- cc: Zack Weinberg <zackw at stanford dot edu>, Neil Booth <neil at daikokuya dot demon dot co dot uk>, Ziemowit Laski <zlaski at apple dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
--On Monday, June 18, 2001 02:31:49 PM -0700 Stan Shebs <shebs@apple.com>
wrote:
> ruling that \p with the semantics as proposed by Zem is permanently
> unacceptable for FSF GCC, and then we can move on to the many other
> things that need to be done.
Even though I am normally the most rabid anti-extensionist on this list, I
am
sympathetic to this particular extension. I do think that it needs to have
complete semantic documentation, which means answering the questions Joseph
raised about what happens with `const char s[2] = "\pxy"' and such.
The reason I am disposed favorably towards this extension is that it is, I
think,
relatively easy to figure out what all of those questions are -- and then
to come
up with reasonable answers. Once the string enters the compiler proper, it
is
almopst like any other string -- "\pxy" is just like "\002xy", but without
a
terminating NUL.
I do think that we need to get a complete description of the semantics.
Basically,
I think the questions boil down to:
- What is the type of "\p..."?
- What is the representation of "\p..."?
I think the answers are:
- `char[n]' where `n' is one greater than the number of characters in the
string itself , in order to allow room for the `\p'. And make the
elements
of the array `const char' in those modes where we do the same for an
ordinary
string literal.
- The string, without a trailing NUL, prefaced with a length byte.
Given that, I should think that the entire change could be done in
lex_string.
--
Mark Mitchelll mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com