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: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Subject: Re: PATCH: Support for Pascal strings
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Date: Sat, 16 Jun 2001 01:24:37 +0100 (BST)
- cc: Ziemowit Laski <zlaski at apple dot com>, <gcc-patches at gcc dot gnu dot org>
On Sat, 16 Jun 2001, Neil Booth wrote:
> Ziemowit Laski wrote:-
> > I would humbly like to propose to add support for Pascal-style
> > string literals in gcc.
>
> I'm not in favour of adding more stuff to CPP to support non-C
> languages. We've already removed support for random things we used to
I agree this extension is a mess and a bad idea. Besides, you can already
approximate what you want without further extensions:
#define __pascal_string(s) \
((const unsigned char *)&(struct { \
unsigned char __len; \
const char __string[__builtin_strlen(s)]; \
}){ __builtin_strlen(s), s })
(Note, however, that the result of __pascal_string here has only C99 block
scope, which may not be what you want, and that there are some bugs in the
handling of compound literals.)
--
Joseph S. Myers
jsm28@cam.ac.uk