This SHOULD NOT work in BP or any flavor of Pascal, any more than the following should work:
const Digit: array[0..255] of 0..9 = 123456789101112;
A string is a different data type than an array of char, with a lot of different methods.
I am surprised tht BP identifies short arrays of char with short strings.
Would (and should) this work?
program foo;
var ch1, ch2, ch3: array[1..100] of char;
begin ch1 := '123'; ch2 := '456'; ch3 := ch1+ch2; (* or ch3 := Concat(ch1, ch2); *) Writeln(ch3, ' ', Length(ch3)); end.
I say absolutely not. HF
Contestcen@aol.com wrote:
NO, YOU, DON'T!
People have been telling you this all the time, why don't you listen? THIS DOES WORK IN BP:
program foo; const ch: array[1..100] of char = 'When in'; begin end.
(It doesn't work with 1000 indeed, as BP has a string length limitation of 255, but that's just a BP quirk.)
That's very nice. However, please recall that I said the main reason for using a character array instead of a string is because I needed more than 255 characters. So, having a better way to initialize a character array of up to 255 characters doesn't help me. If I only wanted 255 characters I would have used a string in the first place.
You may call this "just a BP quirk" but when you are using BP, or when you want to be compatible with BP it is not a "quirk" it is a real limitation. I have to assume that some of the users of the Pascal Macro Compiler will be using BP, regardless of whatever else exists.