QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: NOVARSEG on March 05, 2021, 10:56:50 pm
-
So I am messing with EXE files with DAV hex editor and found that
DIM A AS _UNSIGNED LONG
DIM B AS _UNSIGNED LONG
GOTO LL1
A = 1094795585
LL1:
PRINT A
B = 1094795585
In the EXE file there is no trace of the compiled instruction for A = 1094795585
is that normal?
When the GOTO is commented out, then both instructions for A = 1094795585 and B = 1094795585 show up in the EXE
DIM A AS _UNSIGNED LONG
DIM B AS _UNSIGNED LONG
'GOTO LL1
A = 1094795585
LL1:
PRINT A
B = 1094795585
What about this case. What will the compiler do now?
DIM A AS _UNSIGNED LONG
DIM B AS _UNSIGNED LONG
DIM r AS SINGLE
r = RND
IF r > .5 AND r < .6 THEN GOTO LL1
A = 1094795585
LL1:
PRINT A
B = 1094795585
-
https://en.m.wikipedia.org/wiki/Dead_code_elimination
-
For that last code example
DIM A AS _UNSIGNED LONG
DIM B AS _UNSIGNED LONG
DIM r AS SINGLE
r = RND
IF r > .5 AND r < .6 THEN GOTO LL1
A = 1094795585
LL1:
PRINT A
B = 1094795585
The compiler will not skip the instruction because the GOTO is conditional