From: dpb on 16 Oct 2009 16:08 Schmidt wrote: ....> But that was not, what I meant to demonstrate. Somehow, why am I not surprised that Eduardo either completely missed the point (again) or (I'm beginning now to think perhaps) is simply trolling. Nobody could possibly otherwise be so obtuse, could they??? :) -- From: Eduardo on 16 Oct 2009 17:07 Schmidt escribi�: > If everything is ZeroBased (also the Scroller-Min-Value), then > everything "feels and works just naturally" - i.e. you can > calculate the current ListIndex that was "just clicked" in a > MouseDown-Event for example this way: > > ListIdx = (MouseY - HeaderHeight) \ RowHeight + VScroll.Value Let's see it in an example of the outside world: there are ten blocks, each block has 100 meters. A person starts from the beginning and walks 150 meters. In which block is the person? Of course he is in the second, in the middle of the second block exactly. BlockNumber = Int (MetersWalked \ BlockLenght) +1 OK, you have to cut the fractional part and add 1. Or should we also say that the first block must be numbered 0? In that case we only need to cut the fractional part: BlockNumber = Int (MetersWalked \ BlockLenght) From: Larry Serflaten on 16 Oct 2009 17:14 "Eduardo" wrote > Of course there are situations when 0 based is more appropriate, or even > required, but _my opinion_ is that in general (and not just for me), > there are many more situation that 1 based is more natural. My opinion would be the reverse. There are many more situations where 0 based indexing is more appropreate than for any other number. About the only time I 'regularly' use 1 based arrays is when dealing with files whose first record or character is always at position 1. For the majority of all other uses, 0 is the desired lower bound. As others have said, since 0 based indexing allows the compiler to produce more optimal code, I would agree that 0 should be the default. LFS First  |  Prev  |  Pages: 2 3 4 5 6 7 8 9 10 11 12 Prev: Array of pointersNext: Will this object get destroyed?