diff options
Diffstat (limited to 'miniany/test1.c')
-rw-r--r-- | miniany/test1.c | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/miniany/test1.c b/miniany/test1.c index 30650f0..4c919ce 100644 --- a/miniany/test1.c +++ b/miniany/test1.c @@ -1,8 +1,23 @@ /* test1 */ +/* TODO: check void (no return allowed) and check for int (in this case it is required) */ +int f( ) +{ + return 42; +} + +void f2( ) +{ + putint( 44 ); +} + void main( ) { - char c; + // TODO: allow enumeration of variable declarations + char c1; + char c2; + char c3; + char c4; int i; int j; int k; @@ -31,15 +46,26 @@ void main( ) i = 5; while( i > 0 ) { putint( i ); - i = i-1; + i = i - 1; } i = 1; do { putint( i ); - i = i+1; + i = i + 1; } while( i <= 5 ); - c = 41; - c = c + 1; - putchar( c ); + c1 = 422; // TODO: wrong narrowing from int const to char type, must be catched + c1 = 41; + c2 = c1 + 1; + c3 = c2 + 1; + c4 = c3 + 1; + putchar( c1 ); + putchar( c2 ); + putchar( c3 ); + putchar( c4 ); + i = f( ); + putint( i ); + f2( ); + // TODO: disallow this assignment, LHS is a function, RHS is an integer literal + //f = 1; } |