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: Daniel Jacobowitz <dmj+ at andrew dot cmu dot edu>
- Subject: Re: PATCH: Support for Pascal strings
- From: Ziemowit Laski <zlaski at apple dot com>
- Date: Thu, 21 Jun 2001 14:10:32 -0700
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
>> 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.
As for the deprecated const-convesion issue raised by Joseph Meyers
(ISO/IEC:14882
subclause 4.2 [conv.array] paragraph 2), it is currently *not* allowed
for Pascal strings,
though I suppose we could allow it for symmetry's sake. Another issue
is unsignedness.
Currently, our Pascal-string-enhanced C++ compiler does not allow
const char *p = "\pHello"; /* error - unsigned has been dropped */
but does allow
const char p[] = "\pHello";
which I guess is consistent with semantics for ordinary C string
literals (i.e, 'const unsigned char *p = "Hello"' is an error, but
'const unsigned
char p[] = "Hello"' is not).
--Zem
--------------------------------------------------------------
Ziemowit Laski Apple Computer, Inc.
zlaski@apple.com 2 Infinite Loop, MS 302-4SN
+1.408.974.6229 Fax .1344 Cupertino, CA 95014-2085