Support for static variables complete
git-svn-id: http://picoc.googlecode.com/svn/trunk@547 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
cab5e8b2d8
commit
a2cb2e2efd
26
tests/51_static.c
Normal file
26
tests/51_static.c
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
static int fred = 1234;
|
||||||
|
static int joe;
|
||||||
|
|
||||||
|
void henry()
|
||||||
|
{
|
||||||
|
static int fred = 4567;
|
||||||
|
|
||||||
|
printf("%d\n", fred);
|
||||||
|
fred++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
printf("%d\n", fred);
|
||||||
|
henry();
|
||||||
|
henry();
|
||||||
|
henry();
|
||||||
|
henry();
|
||||||
|
printf("%d\n", fred);
|
||||||
|
fred = 8901;
|
||||||
|
joe = 2345;
|
||||||
|
printf("%d\n", fred);
|
||||||
|
printf("%d\n", joe);
|
||||||
|
}
|
8
tests/51_static.expect
Normal file
8
tests/51_static.expect
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
1234
|
||||||
|
4567
|
||||||
|
4568
|
||||||
|
4569
|
||||||
|
4570
|
||||||
|
1234
|
||||||
|
8901
|
||||||
|
2345
|
|
@ -45,7 +45,8 @@ TESTS= 00_assignment.test \
|
||||||
47_switch_return.test \
|
47_switch_return.test \
|
||||||
48_nested_break.test \
|
48_nested_break.test \
|
||||||
49_bracket_evaluation.test \
|
49_bracket_evaluation.test \
|
||||||
50_logical_second_arg.test
|
50_logical_second_arg.test \
|
||||||
|
51_static.test
|
||||||
|
|
||||||
%.test: %.expect %.c
|
%.test: %.expect %.c
|
||||||
@echo Test: $*...
|
@echo Test: $*...
|
||||||
|
|
Loading…
Reference in a new issue