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


On Fri, 29 Jun 2001, Ziemowit Laski wrote:

> Yes, I have to be more careful when pasting in the diffs -- the 
> surrounding text seems all right, though (or else this line will be 
> wrapped as well...).

You also need to ensure tabs and spaces don't get confused.  Pasting is
generally a bad way of doing things.  If you can't get your mailer to
behave, then attaching as text/plain can be used, but having patches in
the body of the messages is preferred.

> I have no problem with fixing this "in principle", except that the above 
> line is not part of my patch and there are plenty more just like it 
> throughout the source tree... :)

OK, those should be fixed separately.  There's at least one missing space 
in a line added in your patch,

+         if (length -2 > 255)

That line also fails to allow for target bytes being wider than 8 bits.

> The logic being patched (in both c-typeck.c and cp/typeck2.c) has to do 
> with initializing wide char arrays with narrow strings and vice versa.  
> Without the patch, Pascal strings would be mistaken for wide strings.  
> I'm not sure what kind of documentation or test case I should provide 
> here (please advise) since the objective here is to maintain existing 
> semantics rather than to add functionality.

Test initialising each kind of array (char, signed char, unsigned char,
wchar_t) with each kind of string literal (normal, Pascal, wide), for both
C and C++, testing that errors occur exactly when they are meant to.

Document that character arrays may be initialised with Pascal string
literals when they may be initialised with normal narrow ones.

> I will work on this further.  Which deprecated conversion to unsigned 
> char * do you speak of -- can you point me to the appropriate section of 
> ISO 14882?

Subcaluse 4.2 [conv.array] paragraph 2 describes the deprecated
conversions for normal and wide string literals.  You said
<URL:http://gcc.gnu.org/ml/gcc-patches/2001-06/msg01376.html> that there
wasn't such a conversion for Pascal strings, so you need to document that
fact and include a testcase.

-- 
Joseph S. Myers
jsm28@cam.ac.uk


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