Page 1 of 1
NXC array struct multiplication bug
Posted: 11 Feb 2011, 17:49
by spillerrec
Code: Select all
task main(){
LocationType p[] = { {10,10}, {30,50}, {55, 20}, {80, 20}, {100, 50} };
p[2] *= 2;
NumOut( 0, LCD_LINE1, p[0].X );
NumOut( 0, LCD_LINE2, p[0].Y );
for(;;);
}
The results I'm getting on the screen is 20 and 20, even though I'm trying to access an element that should have been changed.
It seems that p[2]*=2 is handled incorrectly, instead of multiplying the third element of p, it multiplies the whole p array, as if it hadn't noticed it being an array.
Re: NXC array struct multiplication bug
Posted: 12 Feb 2011, 01:40
by afanofosc
I fixed this today. The math assignment code worked for arrays of scalars but not arrays of user-defined types. I added a bit of code to check for and properly handle that case.
John Hansen
Re: NXC array struct multiplication bug
Posted: 12 Feb 2011, 11:08
by h-g-t
Noted you have modified BCC but when I went to get the new version it is still shown as version 3888 of 2010-06-09.
Assuming the change was in the latest test release I tried to download that but the link was unavailable :-
An error has been encountered in accessing this page.
1. Server: bricxcc.sourceforge.net
2. URL path: /test_release.zip
3. Error notes: NONE
4. Error type: 404
5. Request method: GET
6. Request query string: NONE
7. Time: 2011-02-12 11:03:07 UTC (1297508587)
Re: NXC array struct multiplication bug
Posted: 12 Feb 2011, 19:04
by spillerrec
John, thanks
h-g-t, the link have changed, the new test releases are placed in a folder here:
http://bricxcc.sourceforge.net/test_releases/
I haven't really stayed updated lately tough so I don't know if it have changed again, as the latest release in that folder is 3 months old.
Re: NXC array struct multiplication bug
Posted: 12 Feb 2011, 19:12
by HaWe
yes, unforunately the latest version is still from 2010, Nov 03. :(
Re: NXC array struct multiplication bug
Posted: 13 Feb 2011, 20:20
by mrblp
Hello there,
You can download the source code here (End of page, "Download GNU tarball"):
http://bricxcc.svn.sourceforge.net/viewvc/bricxcc/
Install the source code anywhere, change directory to "NXC" and compile it with "make -f nbcwin32.mak". Some GNU tools (gzip, tar, make) and the free pascal compiler need to be installed before.
I only use linux so I only could deliver the unix binaries...
Bye marvin
Re: NXC array struct multiplication bug
Posted: 14 Feb 2011, 16:16
by afanofosc
I haven't uploaded a new test release that contains the fix for this bug. But as marvin noted it is possible to build from SVN source code (which has the fix checked in). I will upload a new test release and a new official release later this week.
John Hansen
Re: NXC array struct multiplication bug
Posted: 14 Feb 2011, 20:31
by m-goldberg
afanofosc wrote:I haven't uploaded a new test release that contains the fix for this bug. But as marvin noted it is possible to build from SVN source code (which has the fix checked in). I will upload a new test release and a new official release later this week.
Could you find time to upload a new official release for OS X, too? I would very much appreciate that.