BUG: String schemas as function parameters

Sun, 22 Sep 1996 17:10:26 +0200 (MET DST)


gnu pascal unit problem_(re) 
Newsgroups: comp.os.msdos.djgpp
References: 
Organization: Universitaet Essen, Germany
Reply-To: peter.gerwinski@uni-essen.de
Distribution: 

Helge Kruse (hk@bercos.de) wrote:
> I downloaded the version 1.2-2.7.2 of gpc and tried a unit
> sample. But the code won't work. It's so small, that Id like
> to post the code here:

> program p1;
> (* This program does NOT work correctly with GPC 2.7.2  *)
> (* compiled with 'gpc --automake p1.pas' the a.out will *)
> (* be compiled. But the function u1 in the unit u1      *)
> (* does not prints the parameter.                       *)
> (* Renaming the unit, so that unit/function name differ *)
> (* gives no success.					  *)

The function u1 accepts a formal parameter of type "String".
Other than in Borland Pascal, this does not default to a
String of maximum length 255 but stands for a String Schema
type which is something more complicated.

Indeed, you discovered a bug.  Thank you for the report.

To work around, use Strings of known maximum length instead
of generic String Schemas, i.e.

    Type
      WrkString = String ( 80 );

    Function u1 ( S: WrkString ): whatever;

(Also posted to the GNU Pascal mailing list.)

    Peter

      e-mail:  peter.gerwinski@uni-essen.de
home address:  D\"usseldorfer Str. 35, 45145 Essen, Germany
         WWW:  http://agnes.dida.physik.uni-essen.de/~peter/



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