BF-it icon indicating copy to clipboard operation
BF-it copied to clipboard

[BUG?] Assigning before declaring works, but it shouldn't work.

Open NeeEoo opened this issue 4 years ago • 1 comments

int main() {
    a = 1;
    int a;

    printint(a);
}

NeeEoo avatar Mar 04 '21 11:03 NeeEoo

Good catch The reason for that is that before compiling the function we need to determine how much space to make for the local variables So the compiler actually does two passes: first it goes through all the variable declarations, and in the second pass actually compiles code while ignoring declarations Need to think how to make it smarter

elikaski avatar Mar 06 '21 17:03 elikaski