NXC array struct multiplication bug

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
spillerrec
Posts: 358
Joined: 01 Oct 2010, 06:37
Location: Denmark
Contact:

NXC array struct multiplication bug

Post 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.
My blog: http://spillerrec.dk/category/lego/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: NXC array struct multiplication bug

Post 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
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
h-g-t
Posts: 552
Joined: 07 Jan 2011, 08:59
Location: Albania

Re: NXC array struct multiplication bug

Post 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)
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
spillerrec
Posts: 358
Joined: 01 Oct 2010, 06:37
Location: Denmark
Contact:

Re: NXC array struct multiplication bug

Post 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.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC array struct multiplication bug

Post by HaWe »

yes, unforunately the latest version is still from 2010, Nov 03. :(
mrblp
Posts: 82
Joined: 02 Oct 2010, 14:33

Re: NXC array struct multiplication bug

Post 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
Bye Marvin

- "I think you ought to know I'm feeling very depressed." - (Android Marvin in "The Hitchhiker's Guide to the Galaxy" by Douglas Adams, 1978)
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: NXC array struct multiplication bug

Post 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
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
m-goldberg
Posts: 73
Joined: 29 Sep 2010, 12:05

Re: NXC array struct multiplication bug

Post 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.
Regards, Morton
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests