[comp.sys.acorn] SetMacro and OS_ReadVarVal

bcockburn@acorn.co.uk (Bruce Cockburn) (01/22/91)

Steve,

  Acorn is aware of a bug in the SWI OS_ReadVarVal (PRM page 750).  The
problem arises when an attempt is made to test for the presence of a
variable, the recommended method is to set R2 (the length of the buffer
pointed to by R1) to a negative number.  However IF R4=3 AND the variable is
a macro THEN the fact that R2 is negative is ignored, and the variable is
expanded into the buffer.  If, as is the case with some OS code, the value
passed in R1 is zero or the base of the system heap, total carnage results.

  For new code it is possible to avoid this bug by not setting R4 to 3 when
detecting the presence of a variable.

  Acorn recommends the same as you do, i.e. don't use macro variables for
system path variables.

  This same problem stung me for months.

  Regards Bruce.