Ignore:
Timestamp:
Apr 13, 2017, 8:29:38 PM (5 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
1a16e9d
Parents:
c87eb50
Message:

penultimate thesis draft

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/rob_thesis/ctordtor.tex

    rc87eb50 r0111dc7  
    291291struct X *_tmp_ctor;
    292292struct 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  ),
    294297  1.5
    295298), _tmp_ctor; // produce constructed result of malloc
     
    500503  S s0, s1 = { 0 }, s2 = { 0, 2 }, s3 = s2;  // okay
    501504  {
    502     void ?{}(S * s, int i) { s->x = i*2; } // locally hide autogen constructors
     505    void ?{}(S * s, int i) { s->x = i*2; } // locally hide autogen ctors
    503506    S s4;  // error, no default constructor
    504507    S s5 = { 3 };  // okay, local constructor
     
    577580As 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.
    578581
     582\begin{sloppypar}
    579583In addition, constructor calls do not support unnamed nesting.
    580584\begin{cfacode}
     
    594598That 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@.
    595599In 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}
    596601
    597602More precisely, constructor calls cannot have a nesting depth greater than the number of array dimensions in the type of the initialized object, plus one.
     
    877882This means that in general, function signatures would have to be rewritten, and in a select few cases the signatures would not be rewritten.
    878883\begin{cfacode}
    879 __attribute__((manageable)) struct A { ... };   // can declare constructors
    880 __attribute__((unmanageable)) struct B { ... }; // cannot declare constructors
    881 struct C { ... };                               // can declare constructors
     884__attribute__((manageable)) struct A { ... };   // can declare ctors
     885__attribute__((unmanageable)) struct B { ... }; // cannot declare ctors
     886struct C { ... };                               // can declare ctors
    882887
    883888A f();  // rewritten void f(A *);
     
    889894Furthermore, no restrictions would need to be placed on whether objects can be constructed.
    890895\begin{cfacode}
    891 __attribute__((identifiable)) struct A { ... };  // can declare constructors
    892 struct B { ... };                                // can declare constructors
     896__attribute__((identifiable)) struct A { ... };  // can declare ctors
     897struct B { ... };                                // can declare ctors
    893898
    894899A f();  // rewritten void f(A *);
Note: See TracChangeset for help on using the changeset viewer.