Changeset 73ac10e
 Timestamp:
 Dec 20, 2018, 11:17:21 AM (5 years ago)
 Branches:
 ADT, aaronthesis, armeh, astexperimental, cleanupdtors, deferred_resn, enum, forallpointerdecay, jacob/cs343translation, jenkinssandbox, master, newast, newastuniqueexpr, no_list, persistentindexer, pthreademulation, qualifiedEnum
 Children:
 aeb8f70, ff5caaf
 Parents:
 8deaf2b
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

src/ResolvExpr/AlternativeFinder.cc
r8deaf2b r73ac10e 1230 1230 1231 1231 // function may return struct or union value, in which case we need to add alternatives 1232 // for implicit conversions to each of the anonymous members, must happen after findMinCost1232 // for implicit conversions to each of the anonymous members, must happen after findMinCost 1233 1233 // since anon conversions are never the cheapest expression 1234 1234 for ( const Alternative & alt : winners ) { 
tests/searchsort.c
r8deaf2b r73ac10e 21 21 22 22 int main( void ) { 23 const unsignedint size = 10;23 const int size = 10; 24 24 int iarr[size]; 25 25 26 for ( i; 0 u~ size ) {26 for ( i; 0 ~ size ) { 27 27 iarr[i] = size  i; 28 28 sout  iarr[i]  ", "; … … 32 32 // ascending sort/search by changing < to > 33 33 qsort( iarr, size ); 34 for ( i; 0 u~ size ) {34 for ( i; 0 ~ size ) { 35 35 sout  iarr[i]  ", "; 36 36 } // for 37 37 sout  endl; 38 for ( i; 0 u~ size ) { // C version38 for ( i; 0 ~ size ) { // C version 39 39 int key = size  i; 40 40 int * v = bsearch( &key, iarr, size, sizeof( iarr[0] ), comp ); … … 43 43 sout  endl; 44 44 45 for ( i; 0 u~ size ) {45 for ( i; 0 ~ size ) { 46 46 int * v = bsearch( size  i, iarr, size ); 47 47 sout  size  i  ':'  *v  ", "; 48 48 } // for 49 49 sout  endl; 50 for ( i; 0 u~ size ) {50 for ( i; 0 ~ size ) { 51 51 unsigned int posn = bsearch( size  i, iarr, size ); 52 52 sout  size  i  ':'  iarr[posn]  ", "; … … 55 55 56 56 // descending sort/search by changing < to > 57 for ( i; 0 u~ size ) {57 for ( i; 0 ~ size ) { 58 58 iarr[i] = i + 1; 59 59 sout  iarr[i]  ", "; … … 61 61 sout  endl; 62 62 { 63 int ?<?( int x, int y ) { return x > y; } 64 qsort( iarr, size ); 65 for ( i; 0u ~ size ) { 63 // redefinition of ?<? can't overlap the loop controls: 64 //int ?<?( int x, int y ) { return x > y; } 65 { 66 int (*?<?)(int, int) = ?>?; 67 qsort( iarr, size ); 68 } 69 for ( i; 0 ~ size ) { 66 70 sout  iarr[i]  ", "; 67 71 } // for 68 72 sout  endl; 69 for ( i; 0u ~ size ) { 73 for ( i; 0 ~ size ) { 74 int (*?<?)(int, int) = ?>?; 70 75 int * v = bsearch( size  i, iarr, size ); 71 76 sout  size  i  ':'  *v  ", "; 72 77 } // for 73 78 sout  endl; 74 for ( i; 0u ~ size ) { 79 for ( i; 0 ~ size ) { 80 int (*?<?)(int, int) = ?>?; 75 81 unsigned int posn = bsearch( size  i, iarr, size ); 76 82 sout  size  i  ':'  iarr[posn]  ", "; … … 80 86 81 87 double darr[size]; 82 for ( i; 0 u~ size ) {88 for ( i; 0 ~ size ) { 83 89 darr[i] = size  i + 0.5; 84 90 sout  darr[i]  ", "; … … 86 92 sout  endl; 87 93 qsort( darr, size ); 88 for ( i; 0 u~ size ) {94 for ( i; 0 ~ size ) { 89 95 sout  darr[i]  ", "; 90 96 } // for 91 97 sout  endl; 92 for ( i; 0 u~ size ) {98 for ( i; 0 ~ size ) { 93 99 double * v = bsearch( size  i + 0.5, darr, size ); 94 100 sout  size  i + 0.5  ':'  *v  ", "; 95 101 } // for 96 102 sout  endl; 97 for ( i; 0 u~ size ) {103 for ( i; 0 ~ size ) { 98 104 unsigned int posn = bsearch( size  i + 0.5, darr, size ); 99 105 sout  size  i + 0.5  ':'  darr[posn]  ", "; … … 104 110 int ?<?( S t1, S t2 ) { return t1.i < t2.i && t1.j < t2.j; } 105 111 ofstream & ??( ofstream & os, S v ) { return os  v.i  ' '  v.j; } 106 for ( i; 0 u~ size ) {112 for ( i; 0 ~ size ) { 107 113 sarr[i].i = size  i; 108 114 sarr[i].j = size  i + 1; … … 111 117 sout  endl; 112 118 qsort( sarr, size ); 113 for ( i; 0 u~ size ) {119 for ( i; 0 ~ size ) { 114 120 sout  sarr[i]  ", "; 115 121 } // for 116 122 sout  endl; 117 for ( i; 0 u~ size ) {123 for ( i; 0 ~ size ) { 118 124 S temp = { size  i, size  i + 1 }; 119 125 S * v = bsearch( temp, sarr, size ); … … 121 127 } // for 122 128 sout  endl; 123 for ( i; 0 u~ size ) {129 for ( i; 0 ~ size ) { 124 130 S temp = { size  i, size  i + 1 }; 125 131 unsigned int posn = bsearch( temp, sarr, size ); … … 128 134 sout  endl  endl; 129 135 { 130 unsignedint getKey( const S & s ) { return s.j; }131 for ( i; 0 u~ size ) {136 int getKey( const S & s ) { return s.j; } 137 for ( i; 0 ~ size ) { 132 138 sout  sarr[i]  ", "; 133 139 } // for 134 140 sout  endl; 135 for ( i; 0 u~ size ) {141 for ( i; 0 ~ size ) { 136 142 S * v = bsearch( size  i + 1, sarr, size ); 137 143 sout  size  i + 1  ':'  *v  ", "; 138 144 } // for 139 145 sout  endl; 140 for ( i; 0 u~ size ) {146 for ( i; 0 ~ size ) { 141 147 unsigned int posn = bsearch( size  i + 1, sarr, size ); 142 148 sout  size  i + 1  ':'  sarr[posn]  ", ";
Note: See TracChangeset
for help on using the changeset viewer.