Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
0 registered members (), 631 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Waht is wrong hete ? [Re: Espér] #403269
06/17/12 09:49
06/17/12 09:49
Joined: May 2009
Posts: 5,367
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,367
Caucasus
I have no idea why this crashed before grin All I wanted, is to make it stop crashing. I thought may be it was crashing cause of that "player" wasn't created before running the loop, but I don't know.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Waht is wrong hete ? [Re: 3run] #403274
06/17/12 13:13
06/17/12 13:13
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline
Expert
Germanunkol  Offline
Expert

Joined: Jun 2006
Posts: 2,640
Earth
Esper, I think you're right.
What I was thinking was this:
Code:
while(...)
{
   wait(300);
   ent_remove(my);
   wait(1);        //here, the function would get stopped.
}



But since in the above example the next wait is AFTER checking the loop condition, it would crash.


~"I never let school interfere with my education"~
-Mark Twain
Re: Waht is wrong hete ? [Re: Germanunkol] #403281
06/17/12 16:17
06/17/12 16:17
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
Once you remove a pointer, if it is referenced by any thing, even while loops or ifs, it will crash. If you attend for the function to end after removing the pointer just use "return" to make your life easier. And yes, at the end of the while loop (or any loop for that matter) all the references are checked again. Remember that the function has no idea that the pointer is the king of that function and does not know that is should end once that or any other pointer is gone. In fact every function has a my pointer. That pointer may be Null but it is there.


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!
Re: Waht is wrong hete ? [Re: FoxHound] #403306
06/17/12 23:31
06/17/12 23:31
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
while() is checked before entering the loop, what Esper describes is do{} while();

Proof:
Code:
// Never prints anything
void foo()
{
    while(0)
    {
        printf("Hello World");
    }
}

// Prints out "Hello World" exactly once
void bar()
{
    void *bar = (void *)0x1000;
  
    while(bar)
    {
         printf("Hello World");
         bar = NULL;
         wait(1);
    }
}



Also, PadMalcoms version is correct but depends on early abortion of conditions which isn't supported in Lite-C, so the correct way would be splitting up the condition into two different conditions.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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