[fpc-devel] Re: KOL for freepascal (was: Extend thelibrariespeople!)

Peter Vreman peter at freepascal.org
Tue Jun 7 15:36:19 CEST 2005


> | > procedure x (const str: string);
> | > begin
> | >   filewrite (filedescriptor,pchar(str+#13#10)^,length(str)+2);
> | > end;
> |
> | I do not think this should work. You can't pass the address of a temp
> | like this.
>
> Yes I had to convert some constants to var's (and initialize them) in one
> procedure..
> and I noticed Thaddy did this too. I assume delphi is a bit less strict in
> that it
> let's you get away with the below... but I'm not sure if it's good to be
> less strict
> in this case.. (poor style?) What do you think..

It is even slow. Splitting it in 2 lines is faster since it removes the
implicit string concattenation

filewrite (filedescriptor,pchar(str)^,length(str));
filewrite (filedescriptor,#13#10,2);






More information about the fpc-devel mailing list