Changeset b195498 for doc/theses/mike_brooks_MMath/programs
- Timestamp:
- Apr 24, 2025, 6:35:41 PM (5 months ago)
- Branches:
- master
- Children:
- 6b33e89, f85de47
- Parents:
- f632bd50
- Location:
- doc/theses/mike_brooks_MMath/programs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/mike_brooks_MMath/programs/bkgd-carray-mdim.c
rf632bd50 rb195498 14 14 15 15 int main() { 16 float ar[3][10];17 static_assert( sizeof(float) == 4 ); $\C {// floats (atomic elements) are 4 bytes}$18 static_assert( sizeof(void *) == 8 ); $\C{// pointers are 8 bytes}$16 float mx[3][10]; 17 static_assert( sizeof(float) == 4 ); $\C[3.25in]{// floats (atomic elements) are 4 bytes}$ 18 static_assert( sizeof(void *) == 8 ); $\C{// pointers are 8 bytes}$ 19 19 20 static_assert( sizeof( ar) == 120 ); $\C{// the array, float[3][10]}$21 static_assert( sizeof( ar[0]) == 40 ); $\C{// its first element, float[10]}$22 static_assert( sizeof( ar[0][0]) == 4 ); $\C{// its first grand element, float}$20 static_assert( sizeof(mx) == 120 ); $\C{// the array, float[3][10]}$ 21 static_assert( sizeof(mx[0]) == 40 ); $\C{// its first element, float[10]}$ 22 static_assert( sizeof(mx[0][0]) == 4 ); $\C{// its first grand element, float}$ 23 23 24 static_assert( sizeof(&( ar)) == 8 ); $\C{// pointer to the array, float(*)[3][10]}$25 static_assert( sizeof(&( ar[0])) == 8 ); $\C{// pointer to its first element, float(*)[10]}$26 static_assert( sizeof(&( ar[0][0])) == 8 ); $\C{// pointer to its first grand-element, float*}$24 static_assert( sizeof(&(mx)) == 8 ); $\C{// pointer to the array, float(*)[3][10]}$ 25 static_assert( sizeof(&(mx[0])) == 8 ); $\C{// pointer to its first element, float(*)[10]}$ 26 static_assert( sizeof(&(mx[0][0])) == 8 ); $\C{// pointer to its first grand-element, float*}\CRT$ 27 27 28 float (*p a)[3][10] = &(ar);29 float (*p a0)[10] = &(ar[0]);30 float *p a00 = &(ar[0][0]);28 float (*pm)[3][10] = &(mx); 29 float (*pm0)[10] = &(mx[0]); 30 float *pm00 = &(mx[0][0]); 31 31 32 static_assert( (void *)&ar == (void*)&(ar[0] ) );33 static_assert( (void *)&ar == (void*)&(ar[0][0]) );32 static_assert( (void *)&mx == (void *)&(mx[0] ) ); 33 static_assert( (void *)&mx == (void *)&(mx[0][0]) ); 34 34 35 assert( (void *) p a == (void *) pa0 );36 assert( (void *) p a == (void *) pa00 );35 assert( (void *) pm == (void *) pm0 ); 36 assert( (void *) pm == (void *) pm00 ); 37 37 38 38 // float (*b[3])[10]; 39 float * b[3];39 float * b[3]; 40 40 for (int i = 0; i < 3; i ++) { 41 41 b[i] = malloc(sizeof(float[10])); 42 42 } 43 ar[2][3];43 mx[2][3]; 44 44 b[2][3]; 45 45 /* -
doc/theses/mike_brooks_MMath/programs/lst-features-intro.run.cfa
rf632bd50 rb195498 50 50 51 51 52 while( req & cur = reqs`elems; cur`moveNext)52 while( req & cur = iter( reqs ); advance( cur ) ) 53 53 printf("{%d %d} ", cur.pri, cur.rqr); 54 54 printf("\n"); -
doc/theses/mike_brooks_MMath/programs/lst-features-multidir.run.cfa
rf632bd50 rb195498 79 79 80 80 with(DLINK_VIA(req, req.by_pri)) { 81 while( req & cur = reqs_pri_global`elems; cur`moveNext)81 while( req & cur = iter( reqs_pri_global ); advance( cur ) ) 82 82 printf("{%d %d} ", cur.pri, cur.rqr); 83 83 printf("| "); … … 85 85 86 86 with(DLINK_VIA(req, req.by_rqr)) { 87 while( req & cur = reqs_rqr_42`elems; cur`moveNext)87 while( req & cur = iter( reqs_rqr_42 ); advance( cur ) ) 88 88 printf("{%d %d} ", cur.pri, cur.rqr); 89 89 printf("| "); 90 while( req & cur = reqs_rqr_17`elems; cur`moveNext)90 while( req & cur = iter( reqs_rqr_17 ); advance( cur ) ) 91 91 printf("{%d %d} ", cur.pri, cur.rqr); 92 92 printf("| "); 93 while( req & cur = reqs_rqr_99`elems; cur`moveNext)93 while( req & cur = iter( reqs_rqr_99 ); advance( cur ) ) 94 94 printf("{%d %d} ", cur.pri, cur.rqr); 95 95 printf("\n");
Note:
See TracChangeset
for help on using the changeset viewer.