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:26

needs more longjmp

Name: Anonymous 2010-11-01 17:53

Optimized:

#include <stdio.h>

enum [b][i][u][o]EXCEPTION[/o][/u][/i][/b]_Type {
   DivisionByZero[b][i][u][o]EXCEPTION[/o][/u][/i][/b],
   ぬるぽException
}

typedef struct {
   enum [b][i][u][o]EXCEPTION[/o][/u][/i][/b]_Type type;
   char *message;
}[b][i][u][o]EXCEPTION[/o][/u][/i][/b]

int main() {
   int j=1, i=0;
   struct [b][i][u][o]EXCEPTION[/o][/u][/i][/b] *anus;
   //try {
        if(j == 0) {
            anus = new[b][i][u][o]EXCEPTION[/o][/u][/i][/b](DivisionByZero[b][i][u][o]EXCEPTION[/o][/u][/i][/b], "OH SHI-");
            goto catch;
        }
        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:54

SOME EXCEPTIONS

Name: Anonymous 2010-11-01 17:57

>>3
now with less retardation


#include <stdio.h>

enum
EXCEPTION_Type {
   DivisionByZero
EXCEPTION,
   ぬるぽ
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 = new
EXCEPTION(DivisionByZeroEXCEPTION, "OH SHI-");
            goto catch;
        }
        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

Name: Anonymous 2010-11-01 18:24

>>6


---
EXCEPTION.c    2010-11-01 23:21:57.000000000 +0100
+++
EXCEPTION2.c    2010-11-01 23:21:54.000000000 +0100
@@ -6,13 +6,13 @@
 }
 
 typedef struct {
-   enum
EXCEPTION_Type type;
+   enum
EXCEPTION_Type type;
    char *message;
-}
EXCEPTION
+}
EXCEPTION;
 
 int main() {
    int j=1, i=0;
-   struct
EXCEPTION *anus;
+   struct
EXCEPTION *anus;
    //try {
         if(j == 0) {
             anus = new
EXCEPTION(DivisionByZeroEXCEPTION, "OH SHI-");

Name: Anonymous 2010-11-01 18:27

>>7
I MENA +EXCEPTION *anus;

Name: Anonymous 2010-11-01 23:38

ITT: VALID PERL CODE

Name: Anonymous 2010-11-02 2:28

>>1
free(anus);

Farewell Mr. Anus, Be free!

Name: VIPPER 2010-11-02 4:25

HOLY DICKS!

Name: Anonymous 2010-11-02 16:13

Sooyoung ... xD

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