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: Ziemowit Laski <zlaski at apple dot com>, Daniel Jacobowitz <dmj+ at andrew dot cmu dot edu>
- Subject: Re: PATCH: Support for Pascal strings
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Thu, 21 Jun 2001 16:28:34 -0700
- cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
--On Thursday, June 21, 2001 02:10:32 PM -0700 Ziemowit Laski
<zlaski@apple.com> wrote:
>
>>> The type is 'const unsigned char[strlen("\p...")]', where \p takes up
>>> one character. Pointing to this
>>> literal (in C++) requires a 'const unsigned char *'.
>
> My bad -- I should have said 'const unsigned char[strlen("\p...")+1]', as
> was implied by the examples I gave. So 'const char s[2] = "\pxy"' should
> actually be 'const unsigned char s[4] = "\pxy"'. Sorry for the
> sloppiness.
Good. Can we negotiate the unsignedness?
I cannot imagine very many people rely on this particular aspect of the
extension. In we can make "\p..." be a plan `char' --- signed or unsigned
in the same way that "..." would be -- then we are in business. In that
case, we just have the preprocessor replace \p with the length byte, and
that is it. The change then becomes extremely minimal, both in terms of
semantics and in terms of code.
I am unhappy about the `unsigned char' type because there are no string
literals
with this unsigned-ness in standard C/C++. Therefore, the extension
becomes much
more complex to understand and maintain.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com