Hi, all
I have encountered a bug in the old compiler. See test program below.
I thought perhaps this had been fixed in version 2.1, but when I installed 2.1,
I couldn't get it to compile! I get the message
djgpp.ver: No such file or directory (ENOENT)
I expect this is a simple fix. What am I missing?
FYI, I installed the new gpc files into a new directory, then (because it uses
gcc 2.95.3 rather than the new 3.0.0) I put my old 2.95.3 files into the new
djgpp directory structure, being careful not to overwrite any new gpc files.
I'm running on an Athlon usder win98, and have used gpc for about 5 years.
The problem in the old compiler is a crash when writing.
The reason for the program approach is this: I'm trying to distribute a program
where the user specifies a matrix size in the input file, so I can distribute a
binary and users don't need to have a compiler in order to resize the matrix.
I've worked with this memory model before, and it worked fine. But now I'm
having trouble, and I don't see the problem.
many thanks for the old and new compilers, which make my work possible.
Toby
-------------------------------
program testmem;
const
Xmax = 25;
type
Fieldary = array[1..2] of real;
FPary = array[0..Xmax] of ^Fieldary;
var
Field : FPary;
FSize,
i,j, k,
nx : integer;
begin
writeln;
write('Enter the size: '); {I used 5}
readln(nx);
FSize := 8 * sqr(nx); {making a cube. *8 is for "real"}
for i := 0 to nx do GetMem(Field[i], FSize);
writeln('Memory allocated OK');
for i := 0 to nx do
for j := 1 to nx do
for k := 1 to nx do Field[i]^[j+(nx*k)] := 1.0 * i * j * k;
writeln('Done assigning. Writing...');
for i := 0 to nx do
for j := 1 to nx do begin
for k := 1 to nx do write(Field[i]^[j+(nx*k)]:8:1, ' '); {<== CRASHES
HERE with a GPF}
writeln;
end;
writeln('Freeing memory...');
for i := 0 to nx do if (Field[i] <> Nil) then FreeMem(Field[i]);
end.