mirror of https://github.com/aamine/cbc
r4757@macbookpro: aamine | 2009-05-07 12:12:35 +0900
test address-of more. git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4190 1b9489fe-b721-0410-924e-b54b9192deb8
This commit is contained in:
parent
e06185e56d
commit
c3868b417f
|
@ -0,0 +1,35 @@
|
|||
import stdio;
|
||||
import string;
|
||||
|
||||
struct s {
|
||||
char[8] str;
|
||||
};
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
struct s s;
|
||||
struct s * sp;
|
||||
char *str;
|
||||
|
||||
str = s.str;
|
||||
strcpy(str, "OK");
|
||||
printf("%s", str);
|
||||
|
||||
str = &s.str;
|
||||
strcpy(str, "OK");
|
||||
printf(";%s", str);
|
||||
|
||||
sp = &s;
|
||||
str = sp->str;
|
||||
strcpy(str, "OK");
|
||||
printf(";%s", str);
|
||||
|
||||
sp = &s;
|
||||
str = &sp->str;
|
||||
strcpy(str, "OK");
|
||||
printf(";%s", str);
|
||||
|
||||
puts("");
|
||||
return 0;
|
||||
}
|
|
@ -206,6 +206,7 @@ test_22_pointer() {
|
|||
assert_out "777" ./pointer4
|
||||
assert_out "1;2;3;4;5;6;77;78" ./ptrmemb
|
||||
assert_out "7" ./ptrmemb2
|
||||
assert_out "OK;OK;OK;OK" ./addressof
|
||||
assert_compile_error deref-semcheck1.cb
|
||||
assert_compile_error deref-semcheck2.cb
|
||||
assert_compile_error deref-semcheck3.cb
|
||||
|
|
Loading…
Reference in New Issue