Changeset 2bfee8e for doc/theses/andrew_beach_MMath/code/fixup-empty-f.cfa
- Timestamp:
- Sep 7, 2021, 12:26:06 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 031453c
- Parents:
- 1341ce1 (diff), 812ba3d (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/andrew_beach_MMath/code/fixup-empty-f.cfa
r1341ce1 r2bfee8e 2 2 #include <clock.hfa> 3 3 #include <fstream.hfa> 4 #include <stdlib.hfa> // strto4 #include <stdlib.hfa> 5 5 6 intnounwind_fixup(unsigned int frames, void (*raised_rtn)(int &)) {6 void nounwind_fixup(unsigned int frames, void (*raised_rtn)(int &)) { 7 7 if (frames) { 8 int rtn = nounwind_fixup(frames - 1, raised_rtn); 9 if ( rtn == 42 ) printf( "42" ); // make non-tail recursive 10 return rtn; 11 8 nounwind_fixup(frames - 1, raised_rtn); 9 // "Always" false, but prevents recursion elimination. 10 if (-1 == frames) printf("~"); 12 11 } else { 13 12 int fixup = 17; 14 13 raised_rtn(fixup); 15 return fixup;16 14 } 17 15 } … … 27 25 } 28 26 27 // Closures at the top level are allowed to be true closures. 29 28 void raised(int & fixup) { 30 fixup = total_frames + 42; // use local scope => lexical link31 if ( total_frames == 42 ) printf( "42");29 fixup = total_frames + 42; 30 if (total_frames == 42) printf("42"); 32 31 } 33 32
Note: See TracChangeset
for help on using the changeset viewer.