Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / pas2js / 2021-10

2d array bug?

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

nick's hardware

using Pas2JS Compiler version 2.0.6 [2021/04/15] for Win32 i386

Program test;
  uses browserconsole;
type
  ta = array[0..1,0..1] of integer;
var
  a1 : ta;
  a2 : ta;
begin
  a1[0,0]:=10;
  a1[0,1]:=10;
//make a copy of array
  a2:=a1;
//modify the copy
  a2[0,0]:=99;
  a2[0,1]:=99;
//print contents of original array - it should print 10 10 - but it prints 99 99
//this works normally with single dimension array. have not tested
with three dimensional
  writeln(a1[0,0]);
  writeln(a1[0,1]);
 end.

Reply by email

Mattias Gaertner
to nick's hardware
Show quoted text 27 lines
using Pas2JS Compiler version 2.0.6 [2021/04/15] for Win32 i386 Program test; uses browserconsole; type ta = array[0..1,0..1] of integer; var a1 : ta; a2 : ta; begin a1[0,0]:=10; a1[0,1]:=10; //make a copy of array a2:=a1; //modify the copy a2[0,0]:=99; a2[0,1]:=99; //print contents of original array - it should print 10 10 - but it prints 99 99 //this works normally with single dimension array. have not tested with three dimensional writeln(a1[0,0]); writeln(a1[0,1]); end.

This has been fixed last week in the development version of pas2js.

Mattias

Reply by email

nick's hardware
to Mattias Gaertner

That's great! Thanks for confirming.

Mattias Gaertner wrote 39 lines
On Tue, 5 Oct 2021 15:59:03 -0400 "nick's hardware" wrote: > using Pas2JS Compiler version 2.0.6 [2021/04/15] for Win32 i386 > > Program test; > uses browserconsole; > > type > ta = array[0..1,0..1] of integer; > var > a1 : ta; > a2 : ta; > begin > a1[0,0]:=10; > a1[0,1]:=10; > > //make a copy of array > a2:=a1; > > //modify the copy > a2[0,0]:=99; > a2[0,1]:=99; > > //print contents of original array - it should print 10 10 - but it > prints 99 99 //this works normally with single dimension array. have > not tested with three dimensional > writeln(a1[0,0]); > writeln(a1[0,1]); > end. This has been fixed last week in the development version of pas2js. Mattias _______________________________________________ Pas2js maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js

Reply by email