|
 |
|

November 7th, 2009, 05:51 PM
|
|
Good Idea™
|
|
Join Date: Jul 2007
Location: Australia
Posts: 3,857
|
|
Quote:
Originally Posted by Nestharus
In compiled programming, the switch statement immediately goes to the set case.
|
Are you sure? I've learned most of what you say is assumptions so I doubt I believe that. I don't see what mechanism could make that possible.
|

November 8th, 2009, 12:06 AM
|
 |
o-o
|
|
Join Date: Aug 2006
Posts: 1,223
|
|
Switch statement is just multi branch goto...
jesus4lyf, given who you are I didn't expect I'd have to explain that to you ...
Again, switch statements in JASS are impossible... if you are doing it just for syntax that's just totally misleading, not to mention pointless.
Now, you may call my statements wrong when it comes to JASS, but when it comes to the real world, you'll find I'm right. JASS doesn't follow real world trends, so I may use real world examples since I assume JASS does the same thing.
Quote:
|
I've learned most of what you say is assumptions
|
And where on earth do I get those assumptions? Now we are talking about a feature from real world programming languages, not from JASS, so this is not at all an assumption. If I ever have an assumption, it only ever has to do with JASS relating to hard cold facts from real world languages. I don't just pull them out of a hat.
Last edited by Nestharus; November 8th, 2009 at 12:32 AM.
|

November 8th, 2009, 12:30 AM
|
 |
-= THE GAME =-
|
|
Join Date: Sep 2005
Posts: 1,055
|
|
|
lol ninja edit
i see wut u did thar
I think switch is a really good idea, who cares about efficiency? People who want to be efficient will know to avoid switch.
|

November 8th, 2009, 12:33 AM
|
 |
o-o
|
|
Join Date: Aug 2006
Posts: 1,223
|
|
|
Narks, that post made 0 sense unless you are thinking of using pure trigger evaluations ;|.
Trigger evaluations would be similar to a switch statement actually, but... they'd be hella slow ^^
And if you wanted to do labels.. that'd be like multiple trigger evaluations per trigger evaluation o-o.
|

November 8th, 2009, 12:56 AM
|
 |
-= THE GAME =-
|
|
Join Date: Sep 2005
Posts: 1,055
|
|
|
Actually now that I've read up switch statements, I realize they are different from the "Select Case" statements in visual failbasic.
I thought switch was just like a bunch of if / else statements.
|

November 8th, 2009, 03:00 AM
|
|
Good Idea™
|
|
Join Date: Jul 2007
Location: Australia
Posts: 3,857
|
|
Quote:
Originally Posted by Nestharus
Switch statement is just multi branch goto...
jesus4lyf, given who you are I didn't expect I'd have to explain that to you ...
Again, switch statements in JASS are impossible... if you are doing it just for syntax that's just totally misleading, not to mention pointless.
Now, you may call my statements wrong when it comes to JASS, but when it comes to the real world, you'll find I'm right. JASS doesn't follow real world trends, so I may use real world examples since I assume JASS does the same thing.
And where on earth do I get those assumptions? Now we are talking about a feature from real world programming languages, not from JASS, so this is not at all an assumption. If I ever have an assumption, it only ever has to do with JASS relating to hard cold facts from real world languages. I don't just pull them out of a hat.
|
Quote:
|
Originally Posted by Wikipedia
Optimized switch
It is probably true to say however that many programmers do not realize how extremely important it is to obtain a very compact range of possible values for optimization to actually occur within the switch statement. They assume, incorrectly, that simply using a switch statement in their program is inherently efficient. It may indeed be true that the code is much neater and easier to maintain - but it is certainly not necessarily always optimized for faster execution unless the values are strictly suitable. Sometimes they have to be converted first by the programmer to a more suitable range using a simple transformation (complex/lengthy transformations may defeat the purpose so should be avoided). See algorithmic efficiency for an explanation of how the programmer can "assist" the compiler to make an efficient choice. See also the section 'Compiler generated branch tables' in branch table article for why optimization is not always performed as expected and how to solve this.
|
Important note to self: My hunches are more reliable than Nestharus' "expertise" and it appears he doesn't have any idea what he talks about.
>Switch statement is just multi branch goto...
Do you know how machine code works? Even I understand that there is "jump if", "jump if not", "jump" or "return" - not "jump to this, that, or the other thing based on what value it is".
>I may use real world examples since I assume JASS does the same thing.
>And where on earth do I get those assumptions?
Apparently, they're based on other guesses...
|

November 9th, 2009, 11:47 AM
|
 |
o-o
|
|
Join Date: Aug 2006
Posts: 1,223
|
|
|
Edit
Just realized we were arguing two completely different points from me misreading your post
Last post states this ><
End Edit
Last edited by Nestharus; November 9th, 2009 at 02:25 PM.
|

November 9th, 2009, 12:33 PM
|
 |
Staff Member and irregular helper
|
|
Join Date: Mar 2005
Location: Sweden
Posts: 3,776
|
|
Quote:
Originally Posted by Nestharus
The argument is not about switch statement optimization, so your quote is completely irrelevant -.-.
|
Then what are we talking about? What is there about the switch that isn't "just syntax" or optimization?
|

November 9th, 2009, 02:23 PM
|
 |
o-o
|
|
Join Date: Aug 2006
Posts: 1,223
|
|
Quote:
|
In JASS, it really wouldn't matter whether you were using a switch statement or a set of ifs. In compiled programming, the switch statement immediately goes to the set case. In compiled programming, switch statements are faster than ifs -.-, but this isn't compiled programming is it? It's interpretive, so it really doesn't matter which way or the other .
|
Unless jesus4lyf is arguing about how switch statements are sometimes slower than ifs o-o, and in that case I totally misunderstood because of this-
Quote:
|
Do you know how machine code works? Even I understand that there is "jump if", "jump if not", "jump" or "return" - not "jump to this, that, or the other thing based on what value it is".
|
And now I'm reading that ;o.
Jesus4Lyf was responding to the speed of switch statements in relation to if statements while I was responding that switch statements are different from if.
My bad : D.
I was primarily talking about the fact that they are totally different, which a lot of people didn't understand ; ). Jesus4Lyf took one small portion of my post and talked about that without saying what he was talking about ><.
Quote:
Quote:
|
In compiled programming, the switch statement immediately goes to the set case.
|
Are you sure? I've learned most of what you say is assumptions so I doubt I believe that. I don't see what mechanism could make that possible.
|
I believed he was trying to say that switch were just like if statements with that remark ><, like saying jump etc didn't exist.
I was not debating about optimized switch statements ><.
Quote:
Optimized switch
It is probably true to say however that many programmers do not realize how extremely important it is to obtain a very compact range of possible values for optimization to actually occur within the switch statement
|
lol
Next time jesus4lyf needs to be more clear about what he is responding to.
Final
Also my initial post wasn't fail... my statements were completely correct -.-. Again, we were arguing too completely different points, so I could say the exact same thing about your responses -.- j4l.
Last edited by Romek; November 9th, 2009 at 02:40 PM.
|

November 10th, 2009, 07:11 AM
|
 |
Why no custom sig?
|
|
Join Date: Apr 2005
Posts: 814
|
|
|
I was going to add switch to Zinc but not the ugly C-style break based ones. As for Jass, I think a chain of elseif is more readable considering JASS' audience. And any Jass switch statement would just compile to chained elseifs anyway, so...
|

November 10th, 2009, 08:31 AM
|
 |
_
|
|
Join Date: Nov 2006
Posts: 2,719
|
|
Quote:
Originally Posted by Jesus4Lyf
Do you know how machine code works? Even I understand that there is "jump if", "jump if not", "jump" or "return" - not "jump to this, that, or the other thing based on what value it is".
|
The jump address/offset can be computed at run time. When Nestharus says "multi branch goto" he is referring to a jump table.
|

November 10th, 2009, 12:35 PM
|
 |
o-o
|
|
Join Date: Aug 2006
Posts: 1,223
|
|
|
He knows that already, he was talking about switch statement speed vrs if statement speed.
Don't worry, his statements threw me off too ; )
|

November 10th, 2009, 01:11 PM
|
 |
Swish swish, back and forth.
|
|
Join Date: Jun 2008
Location: ?
Posts: 3,965
|
|
Quote:
Originally Posted by Nestharus
He knows that already, he was talking about switch statement speed vrs if statement speed.
Don't worry, his statements threw me off too ; )
|
Nestharus, you throw yourself off. Takes people 12 posts to explain a simple sentence to you at times.
I don't like the idea of switch, but its uses are fine I suppose.
__________________
[14:43] <Vestras> I hate fags and jews
|

November 10th, 2009, 04:12 PM
|
 |
.
|
|
Join Date: May 2009
Posts: 1,311
|
|
Quote:
Originally Posted by Vexorian
I was going to add switch to Zinc but not the ugly C-style break based ones. As for Jass, I think a chain of elseif is more readable considering JASS' audience. And any Jass switch statement would just compile to chained elseifs anyway, so...
|
Yay!
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|