[fpc-devel]Re: array of char
an0nym0usann0yance at hotmail.com
Fri Sep 29 07:32:09 CEST 2000
> CharsDes1:array[0..383]of char=
> (snipped 4 identical lines...)
> var rr,rt:longint;
> begin for rr:=0 to 383 do write(CharsDes1[rr]); end.
> The program just writes the first 255 characters and
> the other characters instead of write zero codes.
> I think it's a bug because the 'string' isn't equal 'array[0..x]of char'.
The problem is that, when you Assign something to a var-constant
(initialized variable array),
the expression (your long string) will get processed first, before passing
along to the const/var.
Thus, the shortstring Concatenation operation truncated your string before
it is passed to the const.
It is perfectly fine with your data structure. The problem is the way that
it is assigned.
(In other words, you cannot initialize that array directly)
This problem dates back to a similar TP7 problem, where
will cause an error, because TP7 assumes any number without decimal to be an
(This does not happen on FPC, because it is clever enough to do implicit
typecast on constants as well)
Any solutions (tricks, hacks, ...) ?
More information about the fpc-devel