Q: What do we do when we generate a runtime error?  In the case of FreeFile()
   we need to return out of the function...but NOT assign a return value.
   Can this be done?

A: Call __runtimeError(). The stack is manipulated, and your function is
   "returned from" without a retVal. BASIClib takes care of this.

Q: VB does overrange checking on arguments...for example, if a function requires
   a 'short' and the value passed was 40000, then the function would generate a
   runtime error.  However, in C the value would simply get wrapped.

A: In the rare case that your code would have a chance to overflow a variable,
   you should check for wrappage, and if OVERFLOW CHECKING IS ENABLED, throw
   ERR_OVERFLOW, like this:


int vbii_addOne(STATEPARAMS, short x)
{
    if ((x == 32767) && (!(__getInitFlags() & INITFLAG_DISABLE_NUM_OVERFLOW)))
        __runtimeError(ERR_OVERFLOW);
    else
        return(x + 1);
} /* addOne */

   ... vbSlacker will take care of overflow checking in usercode. Note that
   you'll probably only have to check for wrappage in the MathFunctions module.
   That is, if a programmer writes:

   PRINT x% + 100000

   ...than code to check for overflow is added by the compiler before PRINT
   is called, if overflow checking hasn't been disabled. Disabling this check
   means that in the case of overflow, the results are undefined. Either way,
   it is not PRINT's responsibility to check, or care, if x% has overflowed,
   as it just prints it either way. Something like pow() would have to
   concern itself that it's return value hasn't overflowed, if such checking
   is enabled. This is the most efficient way to do this, and is only a rare
   burden on the API developer.

/* end of misc_issues.txt ... */






