Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (kzhao, AndrewAMD, bigsmack, 7th_zorro), 869 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Operator precedence problem #440571
04/28/14 11:49
04/28/14 11:49
Joined: Nov 2012
Posts: 62
Istanbul
T
Talemon Offline OP
Junior Member
Talemon  Offline OP
Junior Member
T

Joined: Nov 2012
Posts: 62
Istanbul
Hello, I think lite-c operator ordering has a problem. When a statement has both a "member of" operator(i.e. "." and "->") and a subscription operator("[]") it handles the subscription first instead of handling them left-to-right. This causes unnecessary parentheses.

For example:

Quote:
struct ABC
{
int arr[10];
}

ABC ex;
ex.arr[0] = 5;


This causes a "subscript requires array or pointer type" error.
So what I do is:

Quote:
(ex.arr)[0] = 5;


The parentheses can get out of hand quickly and the readability of our code would improve substantially if this was fixed.

Last edited by Talemon; 04/28/14 11:50.
Re: Operator precedence problem [Re: Talemon] #440576
04/28/14 12:20
04/28/14 12:20
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
I confirm the problem. This will be fixed in an update - I think the fix is safe as it most likely won't break existing code.

Re: Operator precedence problem [Re: jcl] #440577
04/28/14 12:28
04/28/14 12:28
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Neat!


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Operator precedence problem [Re: jcl] #440600
04/28/14 15:09
04/28/14 15:09
Joined: Nov 2012
Posts: 62
Istanbul
T
Talemon Offline OP
Junior Member
Talemon  Offline OP
Junior Member
T

Joined: Nov 2012
Posts: 62
Istanbul
Originally Posted By: jcl
I confirm the problem. This will be fixed in an update - I think the fix is safe as it most likely won't break existing code.


Thanks for such a quick response!

Re: Operator precedence problem [Re: Talemon] #440611
04/28/14 17:53
04/28/14 17:53
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
ohh it would be so great!


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Operator precedence problem [Re: sivan] #440613
04/28/14 18:06
04/28/14 18:06
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Finally...


Always learn from history, to be sure you make the same mistakes again...
Re: Operator precedence problem [Re: Uhrwerk] #440649
04/29/14 13:42
04/29/14 13:42
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline
Serious User
Rackscha  Offline
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
Originally Posted By: Uhrwerk
Finally...


MY Website with news of my projects:
(for example my current
Muliplayer Bomberman,
GenesisPrecompiler for LiteC
and TileMaster, an easy to use Tile editor)
Sparetime-Development


Moderated by  jcl, Nems, Spirit, Tobias 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1