Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

jump advisory with regards to variable declartion.

Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
01-25-2005 06:16
CODE

//This does not compile.
//(8, 21) : ERROR : Name not defined in within scope.
default
{
state_entry()
{
jump a;
@c;
llWhisper(0,b);
jump d;
@a;
string b="blah";
jump c;
@d;
}
}


CODE

//This compiles and runs with error.
//Script run-time error
//Bounds Check Error
default
{
state_entry()
{
jump a;
string b="blah";
@a;
llWhisper(0,b);
}
}


CODE

//This compiles and runs with error.
//Script run-time error
//Bounds Check Error
default
{
state_entry()
{
jump a;
string b;
@a;
llWhisper(0,b);
}
}


CODE

//This compiles and runs without error.
//and whispers "blah"
default
{
state_entry()
{
jump a;
string b;
@a;
b="blah";
llWhisper(0,b);
}
}
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
01-25-2005 07:06
is this caused by the way the parser reads the file as if it were just straight text, and not reading it as the flow of the script would dictate?

Or does it do that at all?
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
01-25-2005 07:20
From: Samhain Broom
is this caused by the way the parser reads the file as if it were just straight text, and not reading it as the flow of the script would dictate?

Or does it do that at all?


I would assume so. It looks like the script does not follow any jumps during compiling.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Alondria LeFay
Registered User
Join date: 2 May 2003
Posts: 725
01-25-2005 18:55
Yikes, but is there really good reasons to even use jumps?
Francis Chung
This sentence no verb.
Join date: 22 Sep 2003
Posts: 918
01-25-2005 20:44
From: Alondria LeFay
Yikes, but is there really good reasons to even use jumps?


Breaking out of loops, especially nested ones :)
_____________________
--
~If you lived here, you would be home by now~
Tread Whiplash
Crazy Crafter
Join date: 25 Dec 2004
Posts: 291
What Francis said...
01-25-2005 22:39
Yes, the "jump" command is the nicest way to simulate a "break" or "continue" type command - whereby you exit out of a loop or you skip to the start of the next iteration.

However, a "jump" statement like that should be around the "deepest" part of a loop / nested set of commands... So with proper programming practices, like declaring all of your local variables at the top of each level of scope (section of code), you can avoid this problem.

It is a bug that should be looked into, though!

Take care,

--Noel "HB" Wade
(Tread Whiplash)
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
01-26-2005 06:14
Go To Statement Considered Harmful
Edsger W. Dijkstra
http://www.acm.org/classics/oct95/