source: doc/rob_thesis/examples/ctor/member.c @ ad4d035

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since ad4d035 was 7493339, checked in by Rob Schluntz <rschlunt@…>, 8 years ago

incorporate Peter's feedback, handle many TODOs

  • Property mode set to 100644
File size: 322 bytes
RevLine 
[7493339]1struct T {
2  int x;
3};
4const int val = 12223344;
5void ?{}(T * t) {
6  if (t->x == val) printf("uh-oh, constructed twice!\n");
7  t->x = val;
8}
9
10struct S {
11  T t1, t2;
12};
13
14void ?{}(S * this) {
15  // construct both members
16}
17
18void ?{}(S * this, int x) {
19  // forward
20  ?{}(this);
21  ?{}(&this->t1);
22}
23
24int main() {
25  S s = 5;
26}
Note: See TracBrowser for help on using the repository browser.