PDA

View Full Version : Small UI patch



L1A
09-03-2004, 03:59 PM
Keeps track of last 5 IP's or MAC's you have used in your session. Allows you to select one from list or type in a new one.

This has been nagging at me for a long time. So I fixed it.

Fix is for latest cvs of pre_5_0_beta.

L1A

Cryonic
09-03-2004, 06:27 PM
Interesting... Couldn't it hold those values in an array instead of 5 instanced variables...

Just a random thought...

ksmith
09-03-2004, 06:42 PM
Could and should. Nice idea though.

L1A
09-03-2004, 11:33 PM
Yeah I was in a hurry and it kept dumping the last value in my array for some reason. So I used instanced variables. I will play with it some more this weekend.

L1A

L1A
09-04-2004, 09:53 AM
Ok I figured out the array crap. Stupid computers can't count. After you dim an array to say 5 the number 5 is never used again to address the data. Because they start counting at 0 all of a sudden. Why don't we just dim the darn arrays to 4 when we mean 5? Then we all would share the same mental illness.

Ok I will stop ranting. hehe.

Here is the revised patch. It still is a cool feature when you have LAN parties and have to keep switching IPs.

L1A

Cryonic
09-04-2004, 10:21 AM
most computer languages use 0 as the start of an index since it is a valid number and representable in binary rather than wasting one number option by not using it...

purple
09-04-2004, 11:25 AM
Actually, I'd think 0 is the start because the array index is an offset into memory and the first element starts at 0, the second at sizeof*1, the third at sizeof*2, etc.

ksmith
09-04-2004, 01:39 PM
New patch looks good.

Purple is right about why C/C++ starts arrays at 0. I hear pascal starts arrays at 1 though.

PlayarOne
09-04-2004, 01:59 PM
Actually, I'd think 0 is the start because the array index is an offset into memory and the first element starts at 0, the second at sizeof*1, the third at sizeof*2, etc.

That's correct, and exactly the reason why they start counting at 0! Internally, array elements become pointers to memory offsets like this.

Also, if SIZE is the total number of elements in your array, then sizeof*SIZE gives the total size of the array in bytes - very handy.