10-18-2023, 07:54 PM
(10-18-2023, 07:15 PM)Kernelpanic Wrote:Quote:@RhoSigma - You must see it from the library implementors view:Yes, that makes sense. The creator of a library in Basic must take into account that the index of the array can be set to one.
In C there is no such possibility. Textbooks always point out that arrays start at zero because it is abnormal. The first element of an array is the first, not the zeroth.
Basic is much closer to the general idea with Option Base 1.
I have never created a library before, I would have to do it with arrays. And then explicitly set the first element to one. If someone then declares an array with A(0 To 4) there should be a warning that arrays start with one. - Now it gets complicated.
Ok, thanks for the explanation.
We (QB64) have ways of reading the lower and upper bounds of an array usually code lb and ub.
So generic code in library would not assume 0 or 1 but find out exactly lb = lbound(array) ub = ubound(array) and then proceed to use lb and ub.
b = b + ...