Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 18,787 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
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 | 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