www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/09/22/13:24:46

From: peter AT agnes DOT dida DOT physik DOT uni-essen DOT de (Peter Gerwinski)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: gnu pascal unit problem
Date: 22 Sep 1996 15:11:27 GMT
Organization: Universitaet Essen, Germany
Lines: 35
Message-ID: <523kuv$rgb@sun3.uni-essen.de>
References: <Dxx3Bv DOT 2G5 AT bercos DOT de>
Reply-To: peter DOT gerwinski AT uni-essen DOT de
NNTP-Posting-Host: agnes.dida.physik.uni-essen.de
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Helge Kruse (hk AT bercos DOT 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 DOT gerwinski AT uni-essen DOT de
home address:  D\"usseldorfer Str. 35, 45145 Essen, Germany
         WWW:  http://agnes.dida.physik.uni-essen.de/~peter/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019