This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Please support coo.h


Coo - C, Object Oriented
http://sourceforge.net/projects/coo/

---------coo.h--------------
#ifndef __COO_H__
#define __COO_H__

typedef struct VTable /*root of virtual table class*/
{
    long offset; /*servers for FREE*/
} VTable;

#define EXTENDS(s) \
    union \
    { \
        s s; \
        s; \
    };
#define VT(v) const v* vt;
#define EXTENDS2(s,v) \
    union \
    { \
        VT(v) \
        s s; \
        s; \
    };
#ifndef offsetof
#define offsetof(s,m) ((long)&((s*)0)->m)
#endif
#define SUPER(s,m,p) ((s*)((char*)(p)-offsetof(s,m)))
#define FREE(p,vt) free((char*)(p)-(vt)->offset)

#endif

----------------------------------
initialization of the enum:
enum {
  int i;
  float f;
} t={1.5}; //t.f
because of EXTENDS2 in coo.h, compiler needs
to initialze last member of enum.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]