| ??? 09/25/05 14:12 Read: times |
#101511 - setjmp / longjmp Responding to: ???'s previous message |
try...catch can be implemented with C's setjmp / longjmp combination ;-)
It's probably something like this:
try
push global catch struct on stack
set new catch address in the struct
set current stack pointer in the struct
...
if error throw
jump to the catch address in the struct
...
pop catch struct from stack
catch
recall stack pointer from struct
pop catch struct from stack
And if you have no automatic garbage collection (C/C++) you can easily create memory leaks on the heap too. |
| Topic | Author | Date |
| RET to a different address | 01/01/70 00:00 | |
| here is how pseudocode | 01/01/70 00:00 | |
| RET to a different address | 01/01/70 00:00 | |
| no flaw, but 1.000.000 gotchas | 01/01/70 00:00 | |
| That's what I wanted to know | 01/01/70 00:00 | |
| Yes | 01/01/70 00:00 | |
| "clever" | 01/01/70 00:00 | |
| OT: my wife | 01/01/70 00:00 | |
| no flaw, but seriously not recommended | 01/01/70 00:00 | |
| experience | 01/01/70 00:00 | |
| reload SP | 01/01/70 00:00 | |
| restoring stack | 01/01/70 00:00 | |
Recognisable string | 01/01/70 00:00 | |
| named return value | 01/01/70 00:00 | |
| Bad Practice | 01/01/70 00:00 | |
| Well phrased | 01/01/70 00:00 | |
| What I am doing with it | 01/01/70 00:00 | |
| try...catch | 01/01/70 00:00 | |
| setjmp / longjmp | 01/01/70 00:00 | |
| when to try ... catch | 01/01/70 00:00 | |
| the borderline | 01/01/70 00:00 | |
| Promises | 01/01/70 00:00 | |
| who cares if an exceptiom is "acceptable | 01/01/70 00:00 | |
| Parsing input data | 01/01/70 00:00 |



