mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-01-12 11:31:11 +00:00
Added missing c-file.
This commit is contained in:
parent
60f344fd5f
commit
709039de87
24
src/test/kc/global-label-problem.c
Normal file
24
src/test/kc/global-label-problem.c
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// Demonstrates problems with local labels overwriting global labels
|
||||||
|
// This should produce "abca" - but produces "abcc" because the local variable containing "c" overrides the global variable containing "a"
|
||||||
|
|
||||||
|
void main () {
|
||||||
|
print("a");
|
||||||
|
print("b");
|
||||||
|
print1();
|
||||||
|
}
|
||||||
|
|
||||||
|
void print1() {
|
||||||
|
print("c");
|
||||||
|
print("a");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Screen pointer and index
|
||||||
|
char* const SCREEN = 0x0400;
|
||||||
|
char idx = 0;
|
||||||
|
|
||||||
|
void print(char* msg) {
|
||||||
|
while(*msg)
|
||||||
|
SCREEN[idx++] = *msg++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user