Why?
Printable View
Why?
how did u get this asm? did you go and manually write all this or are you using a tool?
[edit]
No semicolon in vbcodeQuote:
why
[/edit]
I'm a living compiler :D
Right, thanks, it's the habit of all other languages.Quote:
Originally posted by MoMad
No semicolon in vbcode
The difference is that you would not need the line at all. If you HAD to have the line, then I totally agree.Quote:
Originally posted by CornedBee
Not if you give those variables good names. Where is the difference between
UBound(arr)
and
UBoundOfArr
?
Extra execution.Quote:
Why [Does the code run slower and it is more error prone]?
If the developer is savvy with the language, the error prone part will probably not be a big deal. He'll see an error in the compiler and immediate smack himself if he did something dumb. My point, however, was that having more code leads to more opportunity to screw up. (A problem that can be applied anywhere).
Yup. If you can't help it though, you have to do it. I just preferred to do it faster. The reason I can't know the size is that I use the DirectX functions to create my geometry. These functions size and resize my arrays for me. The don't, however, tell me the new size of the array. For the most part, they expect you are just going to 'stick' it in to a new DirectX function...Quote:
Do you really want to know how VB handles arrays? It's not pretty, and it's terribly slow.
And resizing arrays often is always a bad idea, it is a sure way to waste time.
Hence my disallusionment and eventual dissatisfaction with the language in general. However, I still have projects started in VB that I'm going to finish.Quote:
The problem of VB is that it is very likely that a seemingly innocent code line takes eons to execute.
:DQuote:
You have chosen the right language to optimize.
Which is definitely my intent.Quote:
I want to add that I once translated array-heavy VB code to C, it ran about 30 times faster...
Keep in mind, that I was just pointing out that I disagree that it is always necessary to keep track of your array sizes when you can programmatically determine them. :)
I think this comes down to the same discussions people have about curly brace positioning.
Is it like this{
or like this
{
Some people feel one way, some others. I just wanted to make sure there were no implications that I weren't aware of. I have found (so far) that there aren't; and to also offer my solution for those who may be looking for it.
In closing, I don't think it's practical to expect that we are going to both feel the same way, and I think it's fair to admit that we both have very valid and practical points, therefore, I offer a truce. Let's agree to disagree.
Can I agree with myself that this thread should *really* be left to sleep, and maybe draw its pension :D
Depends whether you want the speed. For strings, especially (I'm dropping into C not C++ here...), I rarely pass the length around unless there are embedded NULLs. If you need the length then strlen() can handle it. Obviously, if you were in a loop you'd cache the length first, but then abandon it.Quote:
Keep in mind, that I was just pointing out that I disagree that it is always necessary to keep track of your array sizes when you can programmatically determine them. :)
However, if you have a block of *binary* data, there is no way to detect the length without storing it as well.
So, everyone's right in a sense, it just depends what you use it for.
Agree parksie.
Just one question left:
What functions would that be?Quote:
The reason I can't know the size is that I use the DirectX functions to create my geometry.