Again, Porting from another version of ancient proprietary Pascal. In GPC, apparently strings run like this: 4 byte Capacity, 4 byte Length, then the string Data.
In my old compiler strings stored the length and only the length as a CHR(len) up to a length of 255. Where we could write statements like: string[0] := CHR(length); Is there a way to allow this in GPC, if not is it being planned or could someone point me in the direction to add a compiler flag to switch between the two?
Also, if I have a String[15] and String[20] and I want to assign a variable with the value in string15, is there a way to get the compiler to not complain that the types are different?
Thanks, Adam Oldham
----------------------------------------------------------------------- C. Adam Oldham Marconi Commerce Systems Inc. Software Engineer 7300 West Friendly Ave. adam.oldham@marconi.com Greensboro, NC 27420-2087 Phone : 336.547.5952 Fax : 336.547.5079 ----------------------------------------------------------------------- This document contains confidential information of Marconi Commerce Systems Inc. In consideration of the receipt of this document, the recipient agrees not to reproduce, copy, use or transmit this document and/or the information contained herein, in whole or in part, or to suffer such actions by others, for any purpose except with written permission, first obtained, of Marconi Commerce Systems Inc., and further agrees to surrender the same to Marconi Commerce Systems Inc. upon demand. -----------------------------------------------------------------------
On 23 Feb 01, at 14:38, Oldham, Adam wrote:
Again, Porting from another version of ancient proprietary Pascal. In GPC, apparently strings run like this: 4 byte Capacity, 4 byte Length, then the string Data.
In my old compiler strings stored the length and only the length as a CHR(len) up to a length of 255. Where we could write statements like: string[0] := CHR(length); Is there a way to allow this in GPC,
No. But you can use 'SetLength' to set the length of the string.
if not is it being planned
That type of string that you are referring to is what is used in the old Turbo Pascal. I believe that something of that nature is being planned for GPC at some time in the future. I do not think that it is a high priority thing though.
or could someone point me in the direction to add a compiler flag to switch between the two?
No compiler switch will do it. GPC strings are currently implemented as schema. You will have to use 'SetLength' to set the length and 'Length' to get the length.
Also, if I have a String[15] and String[20] and I want to assign a variable with the value in string15, is there a way to get the compiler to not complain that the types are different?
Dunno.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) Author of: Chief's Installer Pro for Win32 http://www.bigfoot.com/~African_Chief/chief32.htm Email: African_Chief@bigfoot.com
Oldham, Adam wrote:
Also, if I have a String[15] and String[20] and I want to assign a variable with the value in string15, is there a way to get the compiler to not complain that the types are different?
What do you mean? Assigning between strings of different capacity works without any warning or error:
program Foo;
var Foo: String (15); Bar: String (20);
begin Foo := Bar; Bar := Foo end.
Frank