BUG: String schemas as function parameters
Subject: Re: gnu pascal unit problem Newsgroups: comp.os.msdos.djgpp References: <Dxx3Bv.2G5@bercos.de> 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/
participants (1)
-
Peter Gerwinski