CONST Definition Question
Posted: Tue Apr 09, 2024 9:09 am
Compiling
results in
On the other hand
compiles, and produces the correct code when the constant is used. Is defining a constant this way across the positive/negative 2-complement boundary not permitted?
Code: Select all
MODULE TestConst;
CONST C = 07FFFFFFFH + 1;
END TestConst.
Code: Select all
Line Col
2 28 Error: compiler exception
System.OverflowException: Arithmetic operation resulted in an overflow.
at ORG.ORG.AddOp(Int32 op, Item& x, Item& y)
at ORP.ORP.SimpleExpression(Item& x)
at ORP.ORP.expression(Item& x)
at ORP.ORP.Declarations(Int32& varsize)
at ORP.ORP.Module()
at Compiler.Compiler.Compile(String source, Writer w, Int32& errcnt)
Code: Select all
MODULE TestConst;
CONST C = 0FFFFFFFFH + 1;
END TestConst.