2
0

exceptions.cpp 543 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. # !!! ST does not support C++ exceptions on cygwin !!!
  3. g++ exceptions.cpp ../../objs/st/libst.a -g -O0 -o exceptions && ./exceptions
  4. */
  5. #include <stdio.h>
  6. #include <exception>
  7. #include "../../objs/st/st.h"
  8. int handle_exception() {
  9. try {
  10. throw 3;
  11. } catch (...) {
  12. return 5;
  13. }
  14. }
  15. void* foo(void* arg) {
  16. int r0 = handle_exception();
  17. printf("r0=%d\n", r0);
  18. return NULL;
  19. }
  20. int main(int argc, char** argv) {
  21. st_init();
  22. st_thread_create(foo, NULL, 0, 0);
  23. st_thread_exit(NULL);
  24. return 0;
  25. }