Home > NULL > In den beginne…

In den beginne…

November 2nd, 2006 Leave a comment Go to comments

Niet nieuw, niet spannend, niet veel… maar voor diegene die net begonnen is met programmeren in C.

#ifndef FALSE
#define FALSE   (0)
#define TRUE    (!FALSE)
typedef int BOOL;
#endif

#define INSIST(b,m...)  \
        {\
            if(!(b)) \
            { \
                fprintf(stderr,"%s, %d: insist '%s' failed!\n",\
                         __FILE__, __LINE__, #b); \
                fprintf(stderr, m); \
                fprintf(stderr, "\n"); \
                abort(); \
            } \
        }

#define HIGH(x,y)       (((x)>(y))?(x):(y))
#define LOW(x,y)        (((x)<(y))?(x):(y))

#define BIT(x)          (1<<(x))

#define SWAP(x,y)       {x^=y;y^=x;x^=y;}
#define SWAPT(x,y,type) {type tmp=x; x=y; y=tmp;}

#define FREE(m)         {free(m); m = NULL;}
Tags: , , ,
  1. No comments yet.
  1. No trackbacks yet.