# Changeset 5546f50b

Ignore:
Timestamp:
Mar 10, 2024, 11:21:18 AM (5 months ago)
Branches:
master
Children:
9398177
Parents:
b64d0f4
Message:

more switch to tabs

Location:
doc/theses/mike_brooks_MMath/programs
Files:
18 edited

Unmodified
Removed
• ## doc/theses/mike_brooks_MMath/programs/array-boundcheck-removal-matmul.cfa

 rb64d0f4 forall( [M], [N], [P] ) void matmul( array(float, M, P) & src1, array(float, P, N) & src2, array(float, M, N) & tgt ) { for (i; M) for (j; N) { tgt[i][j] = 0; for (k; P) tgt[i][j] += src1[i][k] * src2[k][j]; } array(float, P, N) & src2, array(float, M, N) & tgt ) { for (i; M) for (j; N) { tgt[i][j] = 0; for (k; P) tgt[i][j] += src1[i][k] * src2[k][j]; } }
• ## doc/theses/mike_brooks_MMath/programs/array-boundcheck-removal-stdvec.cpp

 rb64d0f4 forall( [M], [N], [P] ) void matmul( array(float, M, P) & src1, array(float, P, N) & src2, array(float, M, N) & tgt ) { for (i; M) for (j; N) { tgt[i][j] = 0; for (k; P) tgt[i][j] += src1[i][k] * src2[k][j]; } array(float, P, N) & src2, array(float, M, N) & tgt ) { for (i; M) for (j; N) { tgt[i][j] = 0; for (k; P) tgt[i][j] += src1[i][k] * src2[k][j]; } } */ float f( vector & a ) { float result = 0; for( int i = 0; i < BOUND(a.size()); i++ ) { result += a.at(i); // hillarious that, while writing THIS VERY DEMO, on first go, I actaully wrote it a[i] } return result; float result = 0; for( int i = 0; i < BOUND(a.size()); i++ ) { result += a.at(i); // hillarious that, while writing THIS VERY DEMO, on first go, I actaully wrote it a[i] } return result; } #include int main( int argc, char ** argv ) { vector v(5); v.at(0) = 3.14; v.at(1) = 3.14; v.at(2) = 3.14; v.at(3) = 3.14; v.at(4) = 3.14; vector v(5); v.at(0) = 3.14; v.at(1) = 3.14; v.at(2) = 3.14; v.at(3) = 3.14; v.at(4) = 3.14; float answer = f(v); float answer = f(v); cout << "answer: " << answer << endl; cout << "answer: " << answer << endl; } void matmul( mat & a, mat & b, mat & rslt ) { size_t m = rslt.size(); assert( m == a.size() ); size_t p = b.size(); for ( int i = 0; i < BOUND(m); i++ ) { assert( p == a.at(i).size() ); size_t n = rslt.at(i).size(); for ( int j = 0; j < BOUND(n); j++ ) { rslt.at(i).at(j) = 0.0; for ( int k = 0; k < BOUND(p); k++ ) { assert(b.at(k).size() == n); // asking to check it too often rslt.at(i).at(j) += a.at(i).at(k) * b.at(k).at(j); } } } size_t m = rslt.size(); assert( m == a.size() ); size_t p = b.size(); for ( int i = 0; i < BOUND(m); i++ ) { assert( p == a.at(i).size() ); size_t n = rslt.at(i).size(); for ( int j = 0; j < BOUND(n); j++ ) { rslt.at(i).at(j) = 0.0; for ( int k = 0; k < BOUND(p); k++ ) { assert(b.at(k).size() == n); // asking to check it too often rslt.at(i).at(j) += a.at(i).at(k) * b.at(k).at(j); } } } } #include int main( int argc, char ** argv ) { mat a(5, vector(6)); mat b(6, vector(7)); mat r(5, vector(7)); matmul(a, b, r); mat a(5, vector(6)); mat b(6, vector(7)); mat r(5, vector(7)); matmul(a, b, r); } #endif
• ## doc/theses/mike_brooks_MMath/programs/array-boundcheck-removal.cfa

 rb64d0f4 forall( [N] ) size_t foo( array( size_t, N ) & a ) { size_t retval = 0; for( i; N ) { retval += a[i]; } return retval; size_t retval = 0; for( i; N ) { retval += a[i]; } return retval; } forall( [N], [M] ) size_t foo( array( size_t, N, M ) & a ) { size_t retval = 0; for( i; N ) for( j; M ) { retval += a[i][j]; } return retval; size_t retval = 0; for( i; N ) for( j; M ) { retval += a[i][j]; } return retval; } forall( [N] ) size_t foo( array( size_t, N ) & a, array( size_t, N ) & b ) { size_t retval = 0; for( i; N ) { retval += a[i] - b[i]; } return retval; size_t retval = 0; for( i; N ) { retval += a[i] - b[i]; } return retval; } forall( [M], [N], [P] ) void foo   ( array(size_t, M, P) & src1, array(size_t, P, N) & src2, array(size_t, M, N) & tgt ) { for (i; M) for (j; N) { tgt[i][j] = 0; for (k; P) tgt[i][j] += src1[i][k] * src2[k][j]; } array(size_t, P, N) & src2, array(size_t, M, N) & tgt ) { for (i; M) for (j; N) { tgt[i][j] = 0; for (k; P) tgt[i][j] += src1[i][k] * src2[k][j]; } }
• ## doc/theses/mike_brooks_MMath/programs/bkgd-carray-arrty.c

 rb64d0f4 // Local Variables: // // compile-command: "sed -f sedcmd bkgd-carray-arrty.c > tmp.c; gcc tmp.c" // // compile-command: "sed -f sedcmd bkgd-carray-arrty.c | gcc -c -x c -" // // End: //
• ## doc/theses/mike_brooks_MMath/programs/bkgd-carray-decay.c

 rb64d0f4 // reusing local var float a[10];} float v; f(  a,  a ); $\C{// ok: two decays, one into an array spelling}$ f( &v, &v ); $\C{// ok: no decays; a non-array passes to an array spelling}$ f( a, a );                                      $\C{// ok: two decays, one into an array spelling}$ f( &v, &v );                            $\C{// ok: no decays; a non-array passes to an array spelling}$ char ca[] = "hello";    $\C{// array on stack, initialized from read-only data}$ char *cp = "hello";     $\C{// pointer to read-only data [decay here]}$ void edit(char c[]) {   $\C{// param is pointer}$ char ca[] = "hello";            $\C{// array on stack, initialized from read-only data}$ char *cp = "hello";                     $\C{// pointer to read-only data [decay here]}$ void edit( char c[] ) {         $\C{// param is pointer}$ c[3] = 'p'; } edit(ca);               $\C{// ok [decay here]}$ edit(cp);               $\C{// Segmentation fault}$ edit("hello");          $\C{// Segmentation fault [decay here]}$ edit( ca );                                     $\C{// ok [decay here]}$ edit( c p );                            $\C{// Segmentation fault}$ edit( "hello" );                        $\C{// Segmentation fault [decay here]}$ void decay( float x[10] ) {
• ## doc/theses/mike_brooks_MMath/programs/bkgd-carray-mdim.c

 rb64d0f4 int main() { float a[3][10]; static_assert(sizeof(float)==4);                        $\C{// floats (atomic elements) are 4 bytes}$ static_assert(sizeof(void*)==8);                        $\C{// pointers are 8 bytes}$ /* As in the last section, we inspect the declaration ... */ float a[3][10]; /* static_assert(sizeof( a ) == 120);                      $\C{// the array, float[3][10]}$ static_assert(sizeof( a[0] ) == 40);            $\C{// its first element, float[10]}$ static_assert(sizeof( a[0][0] ) == 4 );         $\C{// its first grand element, float}$ */ static_assert(sizeof(float)==4);    // floats (atomic elements) are 4 bytes static_assert(sizeof(void*)==8);    // pointers are 8 bytes /* static_assert(sizeof(&(a)) == 8);                       $\C{// pointer to the array, float(*)[3][10]}$ static_assert(sizeof(&(a[0])) == 8  );          $\C{// pointer to its first element, float(*)[10]}$ static_assert(sizeof(&(a[0][0])) == 8  );       $\C{// pointer to its first grand-element, float*}$ The significant axis of deriving expressions from @a@ is now itself,'' first element'' or first grand-element (meaning, first element of first element).'' */ static_assert(sizeof(  a       ) == 120); // the array, float[3][10] static_assert(sizeof(  a[0]    ) == 40 ); // its first element, float[10] static_assert(sizeof(  a[0][0] ) == 4  ); // its first grand element, float float (*pa  )[3][10] = &(a        ); float (*pa0 )   [10] = &(a[0]   ); float  *pa00             = &(a[0][0]); static_assert(sizeof(&(a      )) == 8  ); // pointer to the array, float(*)[3][10] static_assert(sizeof(&(a[0]   )) == 8  ); // pointer to its first element, float(*)[10] static_assert(sizeof(&(a[0][0])) == 8  ); // pointer to its first grand-element, float* static_assert((void*)&a == (void*)&(a[0]   )); static_assert((void*)&a == (void*)&(a[0][0])); float (*pa  )[3][10] = &(a      ); float (*pa0 )   [10] = &(a[0]   ); float  *pa00         = &(a[0][0]); assert( (void *) pa == (void *) pa0  ); assert( (void *) pa == (void *) pa00 ); static_assert((void*)&a == (void*)&(a[0]   )); static_assert((void*)&a == (void*)&(a[0][0])); assert( (void *) pa == (void *) pa0  ); assert( (void *) pa == (void *) pa00 ); //    float (*b[3])[10]; float *b[3]; for (int i = 0; i < 3; i ++) { b[i] = malloc(sizeof(float[10])); } a[2][3]; b[2][3]; //      float (*b[3])[10]; float *b[3]; for (int i = 0; i < 3; i ++) { b[i] = malloc(sizeof(float[10])); } a[2][3]; b[2][3]; /*
• ## doc/theses/mike_brooks_MMath/programs/hello-accordion.cfa

 rb64d0f4 forall( T, [Nclients], [Ncosts] ) struct request { unsigned int requestor_id; array( T, Nclients ) impacted_client_ids; // nested VLA array( float, Ncosts ) cost_contribs; // nested VLA float total_cost; unsigned int requestor_id; array( T, Nclients ) impacted_client_ids; // nested VLA array( float, Ncosts ) cost_contribs; // nested VLA float total_cost; }; forall( T, [Nclients], [Ncosts] ) void summarize( request( T, Nclients, Ncosts ) & r ) { r.total_cost = 0; for( i; Ncosts ) r.total_cost += r.cost_contribs[i]; // say the cost is per-client, to make output vary r.total_cost *= Nclients; r.total_cost = 0; for( i; Ncosts ) r.total_cost += r.cost_contribs[i]; // say the cost is per-client, to make output vary r.total_cost *= Nclients; }
• ## doc/theses/mike_brooks_MMath/programs/hello-array.cfa

 rb64d0f4 forall( [N] ) // array bound array(bool, N) & f( array(float, N) & a, array(float, N) & b ) { array(bool, N) & ret = *alloc(); // sizeof used by alloc for( i; N ) { ret[i] = 0.005 > 2 * (abs(a[i] - b[i])) / (abs(a[i]) + abs(b[i])); } return ret; array(bool, N) & ret = *alloc(); // sizeof used by alloc for( i; N ) { ret[i] = 0.005 > 2 * (abs(a[i] - b[i])) / (abs(a[i]) + abs(b[i])); } return ret; } int main( int argc, char * argv[] ) { int n = ato( argv[1] ); array(float, n) a, b; // VLA for ( i; n ) { a[i] = 3.14 / (i + 1); b[i] = a[i] + 0.005 ; } array(bool, n) & result = f( a, b ); // call sout | "result: " | nonl; for ( i; n ) sout | result[i] | nonl; sout | nl; free( &result ); // free returned storage int n = ato( argv[1] ); array(float, n) a, b; // VLA for ( i; n ) { a[i] = 3.14 / (i + 1); b[i] = a[i] + 0.005 ; } array(bool, n) & result = f( a, b ); // call sout | "result: " | nonl; for ( i; n ) sout | result[i] | nonl; sout | nl; free( &result ); // free returned storage } /* array(float, 10) a; array(float, 20) b; f( a, a ); f( b, b ); f( a, b ); f( a, a ); f( b, b ); f( a, b ); } forall( [M], [N] ) void bad( array(float, M) &a, array(float, N) &b ) { f( a, a ); // ok f( b, b ); // ok f( a, b ); // error f( a, a ); // ok f( b, b ); // ok f( a, b ); // error } #endif forall( [M], [N] ) void bad_fixed( array(float, M) & a, array(float, N) & b ) { if ( M == N ) { f( a, (array(float, M) &)b ); // cast b to matching type } if ( M == N ) { f( a, (array(float, M) &)b ); // cast b to matching type } }
• ## doc/theses/mike_brooks_MMath/programs/hello-md.cfa

 rb64d0f4 forall( [N] ) void print1d_cstyle( array(float, N) & c ) { for ( i; N ) { sout | c[i] | nonl; } sout | nl; for ( i; N ) { sout | c[i] | nonl; } sout | nl; } forall( [N], C & | ar( C, float, N ) ) void print1d( C & c ) { for( i; N ) { sout | c[i] | nonl; } sout | nl; for( i; N ) { sout | c[i] | nonl; } sout | nl; } void fill( array(float, 5, 7) & a ) { for ( i; (ptrdiff_t) 5 ) { for ( j; 7 ) { a[i,j] = 1.0 * i + 0.1 * j; sout | a[[i,j]] | nonl; } sout | nl; } sout | nl; for ( i; (ptrdiff_t) 5 ) { for ( j; 7 ) { a[i,j] = 1.0 * i + 0.1 * j; sout | a[[i,j]] | nonl; } sout | nl; } sout | nl; } 4.0  4.1  4.2  4.3  4.4  4.5  4.6 */
• ## doc/theses/mike_brooks_MMath/programs/lst-features-intro.run.cfa

 rb64d0f4 struct req { int pri, rqr; inline dlink(req); int pri, rqr; inline dlink(req); }; req r1 = {1, 42}, r2 = {2, 42}; r1 = {1, 42}, r2 = {2, 42}; insert_first(reqs, r2); while( req & cur = reqselems; curmoveNext ) printf("{%d %d} ", cur.pri, cur.rqr); printf("{%d %d} ", cur.pri, cur.rqr); printf("\n");
• ## doc/theses/mike_brooks_MMath/programs/lst-features-multidir.run.cfa

 rb64d0f4 struct req { int pri, rqr; inline struct by_pri { inline dlink(req); }; inline struct by_rqr { inline dlink(req); }; int pri, rqr; inline struct by_pri { inline dlink(req); }; inline struct by_rqr { inline dlink(req); }; }; struct req r42a = {1, 42}, r42b = {2, 42}, r17a = {2, 17}, r17b = {3, 17}, r17c = {4, 17}, r99a = {3, 99}; r42a = {1, 42}, r42b = {2, 42}, r17a = {2, 17}, r17b = {3, 17}, r17c = {4, 17}, r99a = {3, 99}; insert_first(reqs_pri_global, r17c); with(DLINK_VIA(req, req.by_pri)) { while( req & cur = reqs_pri_globalelems; curmoveNext ) printf("{%d %d} ", cur.pri, cur.rqr); printf("| "); while( req & cur = reqs_pri_globalelems; curmoveNext ) printf("{%d %d} ", cur.pri, cur.rqr); printf("| "); } with(DLINK_VIA(req, req.by_rqr)) { while( req & cur = reqs_rqr_42elems; curmoveNext ) printf("{%d %d} ", cur.pri, cur.rqr); printf("| "); while( req & cur = reqs_rqr_17elems; curmoveNext ) printf("{%d %d} ", cur.pri, cur.rqr); printf("| "); while( req & cur = reqs_rqr_99elems; curmoveNext ) printf("{%d %d} ", cur.pri, cur.rqr); printf("\n"); while( req & cur = reqs_rqr_42elems; curmoveNext ) printf("{%d %d} ", cur.pri, cur.rqr); printf("| "); while( req & cur = reqs_rqr_17elems; curmoveNext ) printf("{%d %d} ", cur.pri, cur.rqr); printf("| "); while( req & cur = reqs_rqr_99elems; curmoveNext ) printf("{%d %d} ", cur.pri, cur.rqr); printf("\n"); }
• ## doc/theses/mike_brooks_MMath/programs/lst-issues-attach-reduction.hpp

 rb64d0f4 template class list { struct node { LIST_ENTRY(node) links; El elem; }; LIST_HEAD(Impl, node); Impl impl; struct node { LIST_ENTRY(node) links; El elem; }; LIST_HEAD(Impl, node); Impl impl; public: list() { LIST_INIT(&impl); } void push_front( const El & src ) { node * n = new node(); n->elem = src; LIST_INSERT_HEAD(&impl, n, links); } // ... emplace elided list() { LIST_INIT(&impl); } void push_front( const El & src ) { node * n = new node(); n->elem = src; LIST_INSERT_HEAD(&impl, n, links); } // ... emplace elided template void emplace_front( CtorArgs... args ) { El tempEl{args...}; // (mock: avoid real emplacing to keep struct node simple; disucssion is about allocation, not copying) push_front(tempEl); } class IType { node* p; public: IType(node* p) : p(p) {} bool operator!=(IType rhs) {return p != rhs.p;} const El& operator*() {return p->elem;} void operator++() { p = LIST_NEXT(p, links); } }; IType begin() {return IType(LIST_FIRST(&impl)); } IType end() {return IType(NULL); } template void emplace_front( CtorArgs... args ) { El tempEl{args...}; // (mock: avoid real emplacing to keep struct node simple; disucssion is about allocation, not copying) push_front(tempEl); } class IType { node* p; public: IType(node* p) : p(p) {} bool operator!=(IType rhs) {return p != rhs.p;} const El& operator*() {return p->elem;} void operator++() { p = LIST_NEXT(p, links); } }; IType begin() {return IType(LIST_FIRST(&impl)); } IType end() {return IType(NULL); }
• ## doc/theses/mike_brooks_MMath/programs/lst-issues-intrusive.run.c

 rb64d0f4 struct req { int pri, rqr; LIST_ENTRY(req) x; int pri, rqr; LIST_ENTRY(req) x; }; struct req r1 = {1, 42}, r2 = {2, 42}; r1 = {1, 42}, r2 = {2, 42}; LIST_INSERT_HEAD( &reqs, &r2, x); &reqs, &r2, x); LIST_INSERT_HEAD( &reqs, &r1, x); &reqs, &r1, x); struct req *cur; LIST_FOREACH(cur, &reqs, x) printf("{%d %d} ", cur->pri, cur->rqr); printf("{%d %d} ", cur->pri, cur->rqr); printf("\n");
• ## doc/theses/mike_brooks_MMath/programs/lst-issues-multi-static.run.c

 rb64d0f4 struct req { int pri, rqr; LIST_ENTRY(req) by_pri; LIST_ENTRY(req) by_rqr; int pri, rqr; LIST_ENTRY(req) by_pri; LIST_ENTRY(req) by_rqr; }; struct req r42a = {1, 42}, r42b = {2, 42}, r17a = {2, 17}, r17b = {3, 17}, r17c = {4, 17}, r99a = {3, 99}; r42a = {1, 42}, r42b = {2, 42}, r17a = {2, 17}, r17b = {3, 17}, r17c = {4, 17}, r99a = {3, 99}; LIST_INSERT_HEAD(&reqs_pri_global, &r17c, by_pri); struct req *cur; LIST_FOREACH(cur, &reqs_pri_global, by_pri) printf("{%d %d} ", cur->pri, cur->rqr); printf("{%d %d} ", cur->pri, cur->rqr); printf("| "); LIST_FOREACH(cur, &reqs_rqr_42, by_rqr) printf("{%d %d} ", cur->pri, cur->rqr); printf("{%d %d} ", cur->pri, cur->rqr); printf("| "); LIST_FOREACH(cur, &reqs_rqr_17, by_rqr) printf("{%d %d} ", cur->pri, cur->rqr); printf("{%d %d} ", cur->pri, cur->rqr); printf("| "); LIST_FOREACH(cur, &reqs_rqr_99, by_rqr) printf("{%d %d} ", cur->pri, cur->rqr); printf("{%d %d} ", cur->pri, cur->rqr); printf("\n");
• ## doc/theses/mike_brooks_MMath/programs/lst-issues-wrapped-byref.run.cpp

 rb64d0f4 struct req { int pri, rqr; int pri, rqr; }; req r1 = {1, 42}, r2 = {2, 42}; r1 = {1, 42}, r2 = {2, 42}; reqs.push_front( &r2); &r2); reqs.push_front( &r1); &r1); for (auto const& cur : reqs) printf("{%d %d} ", cur->pri, cur->rqr); printf("{%d %d} ", cur->pri, cur->rqr); printf("\n");
• ## doc/theses/mike_brooks_MMath/programs/lst-issues-wrapped-emplaced.run.cpp

 rb64d0f4 struct req { int pri, rqr; int pri, rqr; }; reqs.emplace_front( 2, 42); 2, 42); reqs.emplace_front( 1, 42); 1, 42); for (auto const& cur : reqs) printf("{%d %d} ", cur.pri, cur.rqr); printf("{%d %d} ", cur.pri, cur.rqr); printf("\n");
• ## doc/theses/mike_brooks_MMath/programs/sharectx-demo.cfa

 rb64d0f4 void helper2() { c(); string_sharectx c = {NEW_SHARING}; d(); c(); string_sharectx c = {NEW_SHARING}; d(); } void helper1() { a(); string_sharectx c = {NO_SHARING}; b(); helper2(); e(); a(); string_sharectx c = {NO_SHARING}; b(); helper2(); e(); } int main() { helper1(); helper1(); }
• ## doc/theses/mike_brooks_MMath/programs/sharing-demo.cfa

 rb64d0f4 assert( s1 == "a+c" ); sout | xstr(S1s1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\"; #define S1As1 s1a[1] = '-' S1As1; assert( s1a == "a-c" ); sout | xstr(S1As1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\"; #define S2s1 s2 [1] = '|' S2s1; sout | "\\end{tabular}"; sout | "\\par\\noindent"; sout | "Assignment of a value is just a modificiation." "\nThe aliasing relationship is established at construction and is unaffected by assignment of a value."; assert( s1 == "qrs" ); sout | xstr(S1qrs) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\"; #define S1Atuv s1a = "tuv" S1Atuv; assert( s1a == "tuv" ); sout | xstr(S1Atuv) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\"; #define S2wxy s2  = "wxy" S2wxy; assert( s2 == "wxy" ); sout | xstr(S1S2) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\"; #define S1aaa s1  = "aaa" S1aaa; assert( s2 == "wxy" ); sout | xstr(S1aaa) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\"; #define S2S1 s2  = s1 S2S1; assert( s2 == "aaa" ); sout | xstr(S2S1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\"; #define S2bbb s2  = "bbb" S2bbb; sout | "\t\t\t\t& @s1@\t& @s1_mid@\t& @s2@\t\\\\"; sout | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\"; #define D2_s1mid_ff s1_mid = "ff" D2_s1mid_ff; sout | "\\end{tabular}"; sout | "\\par\\noindent"; sout | "In the \\emph{ff} step, which is a positive example of flow across an aliasing relationship, the result is straightforward to accept because the flow direction is from contained (small) to containing (large).  The following rules for edits through aliasing substrings will guide how to flow in the opposite direction."; sout | "\\par"; assert( s1_mid == "i" ); sout  | xstr(D2_s1mid_i)  | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\"; #define D2_s1mid_empty s1_mid = "" D2_s1mid_empty; sout | "\\end{tabular}"; sout | "\\par\\noindent"; sout | "Multiple portions can be aliased.  When there are several aliasing substrings at once, the text editor analogy becomes an online multi-user editor.  I should be able to edit a paragraph in one place (changing the document's length), without my edits affecting which letters are within a mouse-selection that you had made previously, somewhere else."; sout | "\\par\\noindent"; sout | "\\begin{tabular}{llllll}"; sout | "\t\t\t\t& @s1@\t& @s1_bgn@\t& @s1_crs@\t& @s1_mid@\t& @s1_end@\t\\\\"; #define D2_s1crs_s1 string s1_crs = s1(3, 2)shareEdits D2_s1crs_s1; assert( s1_end == "d" ); sout  | xstr(D2_s1crs_s1)  | "\t& " | s1 | "\t& " | s1_bgn | "\t& " | s1_crs | "\t& " | s1_mid | "\t& " | s1_end | "\t\\\\"; #define D2_s1crs_ppp s1_crs = "+++" D2_s1crs_ppp; // "The extreme form of this shortening happens when a bystander alias is a proper substring of an edit.  The bystander becomes an empty substring." string all = "They said hello again"; string greet     = all(10,5)shareEdits; assert( greet_end == "o" ); greet = "sup"; assert( all == "They said sup again" ); // assert( greet_end == "" ); greet_bgn = "what"; // assert( greet_end == "" );    ------ Should be so, but fails greet_end = "..."; assert( greet_end == "..." );
Note: See TracChangeset for help on using the changeset viewer.