This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: PATCH: Support for Pascal strings




--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


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