?

Log in

No account? Create an account

Previous Entry | Next Entry

Start Counting From    W H A T ? ! ? !

weather: clear
outside: 6°C
mood: hairy spazz
*SSCCRREEEEEEEEEAAAAAAAAARRR*

I'm developing a suite of internal tools using Microsoft's Application APIs through C#. It looks like C++, smells like Java, acts like VB, but has its own soul. It lets me do my thing with the occasional "s'cuse me, Ma'am, my leg is caught in the door". But it's generally Not A Problem®.

There are arrays of item objects in a structure in another object class. No problem. They're only one-dimensional arrays. That really should be no problem (not like the five-dimensional monsters I had to deal with once).

All these arrays start at index one. *dramatic pause*       1... ... ... ONE... ... ...

Who the hell starts counting from one?!?!?!

>K}


Comments

pne
Jan. 8th, 2003 11:20 pm (UTC)
i < Array.GetUpperBound(1)
And I hope the compiler caches the result and doesn't make a method call on the array every time through the loop in the comparison function!

Or can arrays change size dynamically? I suppose so. In that case, you would need to recalculate each time through the loop.

(Oh, and wouldn't the "normal" example use sizeof(Array)/sizeof(Array[0]) rather than plain sizeof(Array)? After all, you want the number of elements in the array, not the number of bytes.)
bride
Jan. 8th, 2003 11:33 pm (UTC)
Re: i < Array.GetUpperBound(1)
And I hope the compiler caches the result and doesn't make a method call on the array every time through the loop in the comparison function!

Yeah, you'd stick it in a variable.

Or can arrays change size dynamically? I suppose so. In that case, you would need to recalculate each time through the loop.

Not that I know of... but it wouldn't surprise me if you could. You can do that in Perl and PHP, you just keep appending elements to the end.

(Oh, and wouldn't the "normal" example use sizeof(Array)/sizeof(Array[0]) rather than plain sizeof(Array)? After all, you want the number of elements in the array, not the number of bytes.)

Yeah, me and my pseudo-code =)

Profile

eLouai
bride
The Bride of the First House

Latest Month

March 2015
S M T W T F S
1234567
891011121314
15161718192021
22232425262728
293031