Whats wrong?!?_(re)
Thu, 12 Jun 1997 00:05:05 +0200 (MET DST)
According to Bernhard Tschirren:
>
> WriteLn('*',Text,'*'); { Prints out with padded #0 }
I think we agree that this is correct. (On Linux, the #0s don't appear
on the screen ... I suspect the operating system (or the "terminal") "eats"
them.)
> WriteLn('*',Trim(Text),'*'); { Also prints out with padded #0 }
ISO 10206 says - in a way I have problems to think of a more cryptic one -
that the thing which is stripped from the String is "the character space".
This implies that there must be exactly one "space" - #32.
Or did I overlook something?
> WriteLn('*',Asciiz2Str(Text),'*'); { Segment Violation }
This is not correct, but it's an unrecognized problem in the source:
A String without specified length cannot be returned as the result of
a function. BP assumes 255 in this situation which is quite natural
because it's BP's maximum size for Strings, but GPC does *not* assume
4G in this case ... but zero. :-(
In my current development version, GPC warns about the problem and
assumes 255 (like BP), but I do not recommend to rely on this. Better
always specify a length for Strings to be returned by functions: "Type
String255 = String ( 255 ); Function Foo: String255;". (Or even better:
avoid to return Strings as function results at all; use "Var Foo: String"
instead which *is* valid.)
> Bye (Im having trouble coming up with unique greetings :-)
Me too, ;-)
Peter
Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer
peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201]
maintainer GNU Pascal [970510] - http://home.pages.de/~gnu-pascal/ [970125]
Peter Gerwinski (peter@agnes.dida.physik.uni-essen.de)
HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada -
Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es