Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C with Exceptions

Name: Anonymous 2010-11-01 17:23


#include <stdio.h>

enum
EXCEPTION_Type {
   DivisionByZeroException,
   ぬるぽException
}

typedef struct {
   enum
EXCEPTION_Type type;
   char *message;
}
EXCEPTION

int main() {
   int j=1, i=0;
   struct
EXCEPTION *anus;
   //try {
      if(j == 0) {
         anus = newException(DivisionByZeroException, "OH SHI-");
         goto catch;
      } else {
         i/j;
         goto finally;
      }
   //}
   catch:
      printf("I DIVIDED BY ZERO: %s", anus->message);
      free(anus);
   finally:
      printf("I'm always executed");
   return 0;
}

Name: Anonymous 2010-11-01 17:58

>>5
>>3
>>1
you have an error at the end of the typedef

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List