#include <stdio.h> #include <string.h> typedef unsigned char lu_byte; #define CommonHeader struct GCObject *next; lu_byte tt; lu_byte marked #define CommonHeader1 {struct GCObject *next; lu_byte tt; lu_byte marked}GCObject1 /* Common type for all collectable objects */ typedef struct GCObject { CommonHeader; } GCObject; typedef struct GCObject1 CommonHeader1; #define M(A) A.marked #define P(A) printf("颜值:%d\n",A.marked) int main() { GCObject allgc; memset(&allgc,0,sizeof(struct GCObject)); allgc.marked = 0xF7; //247 printf("颜值:%d\n",allgc.marked); printf("颜值:%d\n",M(allgc)); //L = G(L)->mainthread; printf("------\n"); P(allgc); printf("*******\n"); GCObject1 allgc1; memset(&allgc1,0,sizeof(struct GCObject1)); allgc1.marked = 0xF8; //248 P(allgc1); return 0; }
结果
颜值:247
颜值:247
------
颜值:247
*******
颜值:248