[ Sorry Frank, for sending it to your privat address first ]
On Tue, Mar 19, 2002 at 12:50:52AM +0100, Frank Heckenbach wrote:
> Carel Fellinger wrote:
>
> > How can I get more details on that bug? I can't find the file
> > daj3.pas on my machine.
>
> It's part of the GPC source distributions, or the separate test
> suite distributions in
> ftp://agnes.dida.physik.uni-essen.de/gnu-pascal/current/.
Okee, downloading both.. I see a file dajmod3.pas, no daj3.pas, seems
like half of the test:) But I get the idea.
> > Does this apply to constant strings only, so can you program around it
> > by declaring var's and initialize them in the init-code of the
> > implementation module? Sure hope so.
>
> No, it applies to variables declared in a module interface.
Did me own test, and it seems that explicitly initializing the var
as part of the var declaration can serve as a workaround, like in:
module c interface;
export c = all;
type s = string(25); { comments, -> output }
var x : s = 'pipo de clown'; { this seems to work }
y : s = ''; { this seems to work }
z : s; { this one fails }
end.
module c implementation;
to begin do
begin
y := 'mama lou'; { this is caried over }
z := 'invisible'; { useless }
writeln(z.capacity, z, length(z)); {-> 00 }
end;
end.
program b;
import c;
begin
writeln(x.capacity, x, length(x)); {-> 25pipo de clown13 }
writeln(y.capacity, y, length(y)); {-> 25mama lou8 }
writeln(z.capacity, z, length(z)); {-> 00 }
x := 'spam';
y := 'and';
z := 'eggs';
writeln(x.capacity, x, length(x)); {-> 25spam4 }
writeln(y.capacity, y, length(y)); {-> 25and3 }
writeln(z.capacity, z, length(z)); {-> 00 }
end.
I sure hope this is inline with your understanding of the bug as I need
this feature in that largish 80's program I'm porting.
--
groetjes, carel