Ignore:
Timestamp:
Mar 9, 2018, 1:28:54 PM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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, resolv-new, with_gc
Children:
e84382b
Parents:
8b001bd (diff), f86c8e5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

more changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/papers/general/Paper.tex

    r8b001bd r3d8f2f8  
    26372637                                                                        & \CT{C}        & \CT{\CFA}     & \CT{\CC}      & \CT{\CCV}             \\ \hline
    26382638maximum memory usage (MB)                       & 10,001        & 2,502         & 2,503         & 11,253                \\
    2639 source code size (lines)                        & 197           & 186           & 133           & 303                   \\
     2639source code size (lines)                        & 197           & 186           & 125           & 293                   \\
    26402640redundant type annotations (lines)      & 27            & 0                     & 2                     & 16                    \\
    26412641binary size (KB)                                        & 14            & 257           & 14            & 37                    \\
     
    29062906}
    29072907\end{cfa}
     2908
     2909\begin{comment}
     2910forall( otype T ) {
     2911        struct stack_node {
     2912                T value;
     2913                stack_node(T) * next;
     2914        };
     2915        struct stack { stack_node(T) * head; };
     2916        void clear( stack(T) & s ) with( s ) {
     2917                for ( stack_node(T) * next = head; next; ) {
     2918                        stack_node(T) * crnt = next;
     2919                        next = crnt->next;
     2920                        ^(*crnt){};
     2921                        free(crnt);
     2922                }
     2923                head = 0;
     2924        }
     2925        void ?{}( stack(T) & s ) { (s.head){ 0 }; }
     2926        void ?{}( stack(T) & s, stack(T) t ) {
     2927                stack_node(T) ** crnt = &s.head;
     2928                for ( stack_node(T) * next = t.head; next; next = next->next ) {
     2929                        *crnt = alloc();
     2930                        ((*crnt)->value){ next->value };
     2931                        crnt = &(*crnt)->next;
     2932                }
     2933                *crnt = 0;
     2934        }
     2935        stack(T) ?=?( stack(T) & s, stack(T) t ) {
     2936                if ( s.head == t.head ) return s;
     2937                clear( s );
     2938                s{ t };
     2939                return s;
     2940        }
     2941        void ^?{}( stack(T) & s) { clear( s ); }
     2942        _Bool empty( const stack(T) & s ) { return s.head == 0; }
     2943        void push( stack(T) & s, T value ) with( s ) {
     2944                stack_node(T) * n = alloc();
     2945                (*n){ value, head };
     2946                head = n;
     2947        }
     2948        T pop( stack(T) & s ) with( s ) {
     2949                stack_node(T) * n = head;
     2950                head = n->next;
     2951                T v = n->value;
     2952                ^(*n){};
     2953                free( n );
     2954                return v;
     2955        }
     2956}
     2957\end{comment}
    29082958
    29092959\medskip\noindent
     
    29432993                return *this;
    29442994        }
    2945         stack & operator= ( stack<T> && o ) {
    2946                 if ( this == &o ) return *this;
    2947                 head = o.head;
    2948                 o.head = nullptr;
    2949                 return *this;
    2950         }
    29512995        bool empty() const { return head == nullptr; }
    29522996        void push( const T & value ) { head = new node{ value, head };  /***/ }
     
    29893033        stack() : head( nullptr ) {}
    29903034        stack( const stack & o ) { copy( o ); }
    2991         stack( stack && o ) : head( o.head ) { o.head = nullptr; }
    29923035        ~stack() { clear(); }
    2993         stack & operator=( const stack & o ) {
     3036        stack & operator= ( const stack & o ) {
    29943037                if ( this == &o ) return *this;
    29953038                clear();
    29963039                copy( o );
    2997                 return *this;
    2998         }
    2999         stack & operator=( stack && o ) {
    3000                 if ( this == &o ) return *this;
    3001                 head = o.head;
    3002                 o.head = nullptr;
    30033040                return *this;
    30043041        }
Note: See TracChangeset for help on using the changeset viewer.