The following is from the PBCC Help:
Is it true? Try compiling the following twice, once with only the 1st Print (the 2nd commented out), once with the 2nd Print (the 1st commented out), and each time look at the size of the exe. The 1st (longer) Print gives a larger executable, about 500 bytes larger. Apparently the “pre-calculated” in the Help refers to expressions in the equate not expressions in the code itself.
Numeric equates which are derived from an equation are pre-calculated by PowerBASIC during the compilation process, to ensure that unnecessary calculations are eliminated from the executable code. If this optimization was not performed, PowerBASIC code would need to perform the same calculation every time the equate was used in the code.
Code:
%a0 = 0 %a1 = 1 %a2 = 2 %a3 = 3 %a4 = 4 %a5 = 5 %a6 = 6 %a7 = 7 %a8 = 8 %a9 = 9 %a10 = 10 %a11 = 11 %a12 = 12 %a13 = 13 %a14 = 14 %a15 = 15 %a16 = 16 %a17 = 17 %a18 = 18 %a19 = 19 %a20 = 20 %s = %a0*2+%a1*3+%a2*3+%a3*4+%a4*4+%a5*5+%a6*6+%a7*7+%a8*7+%a9*6+%a10*3+%a11*2+%a12*3+%a13*4+%a14*5+%a15*6+%a16*7+%a17*6+%a18*5+%a19*3+%a20*9 Function PBMain ' print %a0*2+%a1*3+%a2*3+%a3*4+%a4*4+%a5*5+%a6*6+%a7*7+%a8*7+%a9*6+%a10*3+%a11*2+%a12*3+%a13*4+%a14*5+%a15*6+%a16*7+%a17*6+%a18*5+%a19*3+%a20*9 Print %s WaitKey$ End Function
Comment