Meta Commands
#7
Perhaps a command can be added for library writers to test for this?

CheckBase% = _OPTIONBASE

Returns 1 if OPTION BASE 1
Returns 0 if OPTION BASE 0
Returns -1 if OPTION BASE was not set

I was just playing around with OPTION BASE and arrays and I think I may have found a solution for library writers.

If I do this:

OPTION BASE 1
DIM a(100)
a(0) = 10

I get an error.

However, if I do this:

OPTION BASE 1
DIM a(-1 to 100)
a(0) = 10

all is well. As long as the first number in an array is a negative value it seems to allow the use of index 0 and 1 no matter what OPTION BASE is set to. So for arrays in libraries always start them at -1 and any setting by the programmer using OPTION BASE seems to be ignored.

Is this normal behavior or a loophole that I've found?
Reply


Messages In This Thread
Meta Commands - by NasaCow - 11-16-2022, 03:41 AM
RE: Meta Commands - by mnrvovrfc - 11-16-2022, 04:49 AM
RE: Meta Commands - by NasaCow - 11-16-2022, 11:44 AM
RE: Meta Commands - by SMcNeill - 11-16-2022, 04:06 PM
RE: Meta Commands - by mnrvovrfc - 12-06-2022, 04:08 AM
RE: Meta Commands - by bplus - 11-16-2022, 05:13 AM
RE: Meta Commands - by NasaCow - 11-16-2022, 11:47 AM
RE: Meta Commands - by TerryRitchie - 11-16-2022, 04:28 PM
RE: Meta Commands - by SMcNeill - 11-16-2022, 04:48 PM
RE: Meta Commands - by TerryRitchie - 11-16-2022, 06:50 PM
RE: Meta Commands - by RhoSigma - 11-16-2022, 05:22 PM
RE: Meta Commands - by bplus - 11-16-2022, 05:33 PM
RE: Meta Commands - by mnrvovrfc - 11-16-2022, 06:36 PM
RE: Meta Commands - by SMcNeill - 12-06-2022, 05:26 AM
RE: Meta Commands - by mnrvovrfc - 12-06-2022, 06:07 AM
RE: Meta Commands - by SMcNeill - 12-06-2022, 07:12 AM



Users browsing this thread: 5 Guest(s)