[fpc-devel]Re: array of char

Michael Van Canneyt michael.vancanneyt at wisa.be
Fri Sep 29 10:07:24 CEST 2000


On Fri, 29 Sep 2000, Florian Klaempfl wrote:

> Jonas Maebe schrieb:
> > >Thus, the shortstring Concatenation operation truncated your string before
> > >it is passed to the const.
> > 
> > This is correct.
> 
> No, it isn't. The strings are concatened as ansistrings but 
> when writing the constant, the string is cut off to 255 chars, see
> ptconst.pas
> around line 540:
> 
>                    p:=comp_expr(true);
>                    do_firstpass(p);
>                    if p^.treetype=stringconstn then
>                     begin
>                       if p^.length>255 then
>                        len:=255
>                              ^--- should we fix this?
>                       else
>                        len:=p^.length;
>                       s[0]:=chr(len);
>                       move(p^.value_str^,s[1],len);
>                     end

It depends on the type of the const:
  - For shortstring it should be cut.
  - For pchar not (obvious).
  - for array of char not.
  - for ansistring don't cut either.
Is it possible to determine the type here ?

Michael.
  





More information about the fpc-devel mailing list