Re: AGT Version 1.83


14 Aug 1995 19:41:35 GMT

In article <Pine.SOL.3.91.950813160611.3331E-100000@xmission.xmission.com>,
nick@xmission.xmission.com says...
>
>
>
>On 11 Aug 1995, Joe Schlimgen wrote:
>
>> The biggest problems I had to worry about were strings and arrays. Pascal
can
>> base arrays from [min..max] and C++ always bases them from 0 -- hence the
>> PArray<class T, int min, int max> template. Strings were a bit trickier --
the
>> ANSI string class works well, but I hade to work on the i/o to make it
>> fixed-length (which Pascal appears to have -- more research is needed
there,
>> any answers from the vast and unpaid research dept?).
>
>Pascal DOES NOT have fixed length strings, strings are kinda like arrays,
>this is how it works:
>
[good examples snipped]

Right, my original message was misleading on that part. What I meant was that
the _i/o_ of those strings appears to be fixed length. It appears that enough
memory is allocated to each string for its maximum length plus one (the first
byte being the length of the string, thereby limiting the string to 255
characters plus the length byte making a total of 256 bytes of memory).

On output of a string type into a file, does it write just the string (less
the length byte) or the entire allocated memory (thereby outputing
fixed-length)? This is important because I'm trying to make it so that files
created with the C++ version are exactly like those created with the Pascal
version. Of course, AGT could be padding those strings before output, which I
should find out shortly.

I have a friend who has a few dusty tomes on an older version of Pascal that
he's letting me borrow, so I should be able to figure it out from those, and,
of course, trial and error usually works... eventually.