Changeset 0415e24
- Timestamp:
- Mar 19, 2018, 2:06:25 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
- Children:
- b1ccdfd
- Parents:
- fdfced6
- git-author:
- Rob Schluntz <rschlunt@…> (09/29/17 16:03:44)
- git-committer:
- Rob Schluntz <rschlunt@…> (03/19/18 14:06:25)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/references.c
rfdfced6 r0415e24 49 49 &r1 = x, &&r2 = r1, &&&r3 = r2; 50 50 ***p3 = 3; // change x 51 // ((int&)r3 = 3; // change x, ***r3 51 52 **p3 = &x; // change p1 53 // ((int*&)&r3) = &x; // change r1, (&*)**r3 52 54 *p3 = &p1; // change p2 55 // ((int**&)&&r3) = &p2; // change r2, (&(&*)*)*r3 56 // ((int***&)&&&r3) = p3; // change r3 to p3, (&(&(&*)*)*)r3 53 57 int y = 0, z = 11, & ar[3] = { x, y, z }; // initialize array of references 58 // &ar[1] = &z; // change reference array element 59 // typeof( ar[1] ) p; // is int, i.e., the type of referenced object 60 // typeof( &ar[1] ) q; // is int &, i.e., the type of reference 61 // sizeof( ar[1] ) == sizeof( int ); // is true, i.e., the size of referenced object 62 // sizeof( &ar[1] ) == sizeof( int *); // is true, i.e., the size of a reference 54 63 55 64 // test that basic reference properties are true - r1 should be an alias for x … … 76 85 &z1.r = &z1r; 77 86 &z2.r = &z2r; 87 78 88 z1 = z2; 79 89 }
Note: See TracChangeset
for help on using the changeset viewer.