The MC-3020 model compiler translates the above OAL into C.
C does not have a native string type, so returning strings from functions provides challenges. Namely, a pointer can be returned, but data itself exists “behind the pointer”. This is usually O.K.
However, consider the operations scmp and simple above. What if the strings returned were local variables formed and calculated inside the scope of the respective functions?
In such a case, the return pointer will point to deallocated stack space. This is not good.
To address this, an analysis has been performed outlining options for changing the MC-3020 model compiler. The analysis is documented here.
Please read the above note and provide your thoughts here.