|
So, I'm translating a program I wrote back in 1999 in Delphi to C# and I come across this:
IF (VelArray[Length(VelArray)+4] < 5)
Shouldn't that blow up? Am I or am I not trying to get the value in an array 4 places beyond the end? Or has it been so long that I've forgotten how Delphi/pascal works?
See, people? THIS is why you should comment your code.
Grrr.
|
|
|
|
|
This might fit better in 'The Weird and the Wonderful'.
From the little info Google gave me, this should blow up. There was talk of dynamic arrays, but not much helpful info.
Bob Dole The internet is a great way to get on the net.
2.0.82.7292 SP6a
|
|
|
|
|
I don't know. I do know that in Pascal, array indexing doesn't necessarily begin at 0 (or 1), it could be that the first index is 4 (or more) so this might be OK. :shrug:
|
|
|
|
|
GenJerDan wrote: I'm translating a program I wrote back in 1999
It hurts doesn't it. I have been there myself.
We always think we are producing quality code until we look at what we produced before.
At least we have learned from our mistakes, or at least we hope we have.
modified 7-Dec-12 23:33pm.
|
|
|
|
|
GenJerDan wrote: THIS is why you should comment your code. What would you have commented?
You'd probably have seen the error of your ways, fixed the code and make the comment obsolete
It's an OO world.
public class Naerling : Lazy<Person>{
public void DoWork(){ throw new NotImplementedException(); }
}
|
|
|
|
|
Yeah, except the silly thing has worked for the past 13 years, with no errors. I think I must have forgotten how pascal works. Maybe that "4" is the length (a word? that's silly) at the beginning of the array?
Can't wait until I'm done with this. Assuming I can complete it. There are a lot of custom controls...I may skip them and find replacements. :p
|
|
|
|