[fpc-pascal] a few trivial questions

Graeme Geldenhuys graemeg.lists at gmail.com
Thu May 13 09:33:12 CEST 2010


spir ☣ het geskryf:
>>> Also, is it possible to set a list's base index to 1 (so that
>>> last_index=count)?
>> No. That would break all other existing code.
> 
> I don't understand. If I set myList.baseIndex := 1, how can it affect
> other people's code? It's a new feature that does not touch existing
> codebase.


At one point fpGUI switched all list type components to be 1-based. This
caused such a lot of issues that I very quickly switched it back to
0-based. Why? Because even though my components were 1-based, the FPC lists
where 0-based. So I had to very carefully keep track of which one uses what
and often made mistakes. I personally hate 0-based counting because no
human counts 0, 1, 2 etc.. so why must computers? But because 0-based is so
standardized in programming languages, it's just easier to follow the crowd
than fight them. :-)


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/




More information about the fpc-pascal mailing list