Re: AGT Version 1.83


15 Aug 1995 07:15:25 GMT

In article <Pine.SOL.3.91.950813160611.3331E-100000@xmission.xmission.com>,
Nicholas Gorrell <nick@xmission.xmission.com> wrote:
>
>
>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:

That depends entirely on which dialect of Pascal you're using.

The old Jensen/Wirth standard didn't really have a string datatype
at all, but allowed you to read and write strings into a
packed aay of char with a single read or write statement. Such strings
would indeed be fixed-length, padded with spaces up to the size of the
array.

One of the reasons C programmers flame Pascal so much is that Wirth
made it a fairly minimal language by cutting out a lot of features,
without any real possibility of providing that functionality in a
library (as it's done in C, which is also a minimalistic language). He
seemed to reason that we don't need real strigns, when we can simulate
them with arrays of charaters, we don't need real file IO when we can
simulate it with sequential streams, and so on. As a result, the
language as defined by Wirth is quite clumsy for real programming.

Of course, most commercial implementations intorduce their own string
data types, random files, etc. Turbo Pascal isn't too bad. I've been
out of touch with Pascal for a while so I don't know how the new Pascal
standard treats issues like strings etc.

Magnus