Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (henrybane), 1,246 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 4 1 2 3 4
Re: the comparisons of if clauses are still executed completely [Re: Joozey] #328597
06/14/10 08:56
06/14/10 08:56
Joined: Jul 2000
Posts: 27,987
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,987
Frankfurt
This is planned, but with low priority as it does not make your code worse or longer. You just need to be aware of the fact that you need 'if' instead of '&&' when you want to early abort a comparison. See:

http://manual.3dgamestudio.net/litec_c.htm

Re: the comparisons of if clauses are still executed completely [Re: jcl] #328606
06/14/10 09:37
06/14/10 09:37
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
But in some cases the code can't be replaced by just using "if" instead of "&&":

Code:
ENTITY* ent = NULL;
if(ent != NULL) {
  if (is(ent, FLAG1)) {
    ... do something ...				
  } else {
    ... do something else ...
  }
} else {			
  ... do something else (the same else as above) ...
}



For this code I need either code duplication or I have to set a boolean and check this to decide which code has to be executed.

But it could be like this:

Code:
ENTITY* ent = NULL;
if(ent != NULL && is(ent, FLAG1)) {
  ... do something ...				
} else {
  ... do something else ...
}



So it makes the code worse and longer.

Regards,
Pegamode.

Re: the comparisons of if clauses are still executed completely [Re: pegamode] #328613
06/14/10 10:10
06/14/10 10:10
Joined: Jul 2000
Posts: 27,987
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,987
Frankfurt
Ok, in that case you're right. We'll implement early comparison abort when the compiler is improved the next time.

Re: the comparisons of if clauses are still executed completely [Re: jcl] #328615
06/14/10 10:19
06/14/10 10:19
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Ok. Thanks.

Re: the comparisons of if clauses are still executed completely [Re: pegamode] #328689
06/14/10 17:17
06/14/10 17:17
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
When is "next time"? laugh

Re: the comparisons of if clauses are still executed completely [Re: FBL] #360347
02/23/11 18:19
02/23/11 18:19
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
I just want remind you on this topic and second the question "when is next time" ???

I think that a nowadays compiler should handle something like that properly.

Regards,
Pegamode.

Re: the comparisons of if clauses are still executed completely [Re: pegamode] #360351
02/23/11 18:43
02/23/11 18:43
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
I'm waiting eagerly for this compiler change, too.


"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: the comparisons of if clauses are still executed completely [Re: Superku] #360385
02/23/11 20:15
02/23/11 20:15
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Oh yes!

Re: the comparisons of if clauses are still executed completely [Re: FBL] #360393
02/23/11 20:42
02/23/11 20:42
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Me too ( maybee a present for my birthday today wink )

Re: the comparisons of if clauses are still executed completely [Re: Widi] #360433
02/23/11 22:21
02/23/11 22:21
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Me too. And maybe while you're at it implement the functions with a variable argument number, which has been on the forecast page for ages..? tongue


Always learn from history, to be sure you make the same mistakes again...
Page 3 of 4 1 2 3 4

Moderated by  aztec, Spirit 

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