Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

global static variables take the precedence over function scoped variables #11

Open
Talv opened this issue Feb 23, 2019 · 0 comments
Open

Comments

@Talv
Copy link
Owner

Talv commented Feb 23, 2019

[9:08 PM] folk: @Talv seems I've located a weird namespacing problem in the galaxy interpreter, where 
int[3] foo;
void bar(int foo) {
    int zed;
    zed = foo;
}
[9:08 PM] folk: will try to assign the outer foo, according to sc2edit, and thus it fails to compile it
[9:09 PM] folk: obviously I've no idea if the actual engine would, or even if the compiler used in sc2edit is the same one or not
[9:10 PM] folk: should be noted that in my actual code both the outer foo and the function are static
[1:34 PM] Talv: yeah, it does seem to happen only when outter variable is static - it seems to take the priority O.o
[1:35 PM] Talv: in this specific case it's not harmful since type miss matches and you get insta error
[1:35 PM] Talv: but I imagine it would be problematic if both parameter and global var would be of the same type
[1:35 PM] Talv: it would compile nicely but you'd get unexpected results ;D

https://discordapp.com/channels/271701880885870594/410894496570671117/548596985268273153

static int[3] foo;
void bar(int foo) {
    int zed;
    zed = foo;
}

error: bulk copy not supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant