Changeset 0111dc7 for doc/rob_thesis/ctordtor.tex
- Timestamp:
- Apr 13, 2017, 8:29:38 PM (6 years ago)
- Branches:
- aaron-thesis, arm-eh, 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, resolv-new, with_gc
- Children:
- 1a16e9d
- Parents:
- c87eb50
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/rob_thesis/ctordtor.tex
rc87eb50 r0111dc7 291 291 struct X *_tmp_ctor; 292 292 struct X *x = ?{}( // construct result of malloc 293 _tmp_ctor=malloc_T(sizeof(struct X), _Alignof(struct X)), // store result of malloc 293 _tmp_ctor=malloc_T( // store result of malloc 294 sizeof(struct X), 295 _Alignof(struct X) 296 ), 294 297 1.5 295 298 ), _tmp_ctor; // produce constructed result of malloc … … 500 503 S s0, s1 = { 0 }, s2 = { 0, 2 }, s3 = s2; // okay 501 504 { 502 void ?{}(S * s, int i) { s->x = i*2; } // locally hide autogen c onstructors505 void ?{}(S * s, int i) { s->x = i*2; } // locally hide autogen ctors 503 506 S s4; // error, no default constructor 504 507 S s5 = { 3 }; // okay, local constructor … … 577 580 As a result, it was decided that any attempt to resolve designated function calls with C's function prototype rules would be brittle, and thus it is not sensible to allow designations in constructor calls. 578 581 582 \begin{sloppypar} 579 583 In addition, constructor calls do not support unnamed nesting. 580 584 \begin{cfacode} … … 594 598 That is, in the previous example the line marked as an error could mean construct using @?{}(A *, B)@ or with @?{}(A *, C)@, since the inner initializer @{ 10 }@ could be taken as an intermediate object of type @B@ or @C@. 595 599 In practice, however, there could be many objects that can be constructed from a given @int@ (or, indeed, any arbitrary parameter list), and thus a complete solution to this problem would require fully exploring all possibilities. 600 \end{sloppypar} 596 601 597 602 More precisely, constructor calls cannot have a nesting depth greater than the number of array dimensions in the type of the initialized object, plus one. … … 877 882 This means that in general, function signatures would have to be rewritten, and in a select few cases the signatures would not be rewritten. 878 883 \begin{cfacode} 879 __attribute__((manageable)) struct A { ... }; // can declare c onstructors880 __attribute__((unmanageable)) struct B { ... }; // cannot declare c onstructors881 struct C { ... }; // can declare c onstructors884 __attribute__((manageable)) struct A { ... }; // can declare ctors 885 __attribute__((unmanageable)) struct B { ... }; // cannot declare ctors 886 struct C { ... }; // can declare ctors 882 887 883 888 A f(); // rewritten void f(A *); … … 889 894 Furthermore, no restrictions would need to be placed on whether objects can be constructed. 890 895 \begin{cfacode} 891 __attribute__((identifiable)) struct A { ... }; // can declare c onstructors892 struct B { ... }; // can declare c onstructors896 __attribute__((identifiable)) struct A { ... }; // can declare ctors 897 struct B { ... }; // can declare ctors 893 898 894 899 A f(); // rewritten void f(A *);
Note: See TracChangeset
for help on using the changeset viewer.