2013-04-14 105 views
0

我复制这个结构包/评论评论

typedef struct SDL_Surface { 
Uint32 flags; /* Read-only */ 
SDL_PixelFormat *format; /* Read-only */ 
int w, h; /* Read-only */ 
Uint16 pitch; /* Read-only */ 
void *pixels; /* Read-write */ 
SDL_Rect clip_rect; /* Read-only */ 
8 int refcount; /* Read-mostly */ 
/* This structure also contains private fields not shown 
here */} SDL_Surface; 

,并试图评论(套)出以/ *和* /和开始和代码的结束,但它不会工作。

/* 
typedef struct SDL_Surface { //only commented out this line 
Uint32 flags; /* Read-only */ 
SDL_PixelFormat *format; /* Read-only */ 
int w, h; /* Read-only */ 
Uint16 pitch; /* Read-only */ 
void *pixels; /* Read-write */ 
SDL_Rect clip_rect; /* Read-only */ 
8 int refcount; /* Read-mostly */ 
/* This structure also contains private fields not shown 
here */} SDL_Surface; 
*/ 

任何人都可以帮我吗?

+0

C允许像/ * .../* .. */... * /这样的嵌套注释吗? – NINCOMPOOP

+0

另外,'refcount'附近的“8”是什么? – LSerni

回答

3

使用

#if 0 
blah 
#endif 

为 “注释” 的这样的代码大块。它也有可嵌套的好处。

(原因/**/不评论内部工作,是因为一次,第一*/将结束,所以/* blah /* explanation */ more */explanation后结束,more

1

嵌套评论没有按”但是你可以让预处理器跳过struct

#if 0 

    typedef struct SDL_Surface { 
    Uint32 flags; /* Read-only */ 
    SDL_PixelFormat *format; /* Read-only */ 
    int w, h; /* Read-only */ 
    Uint16 pitch; /* Read-only */ 
    void *pixels; /* Read-write */ 
    SDL_Rect clip_rect; /* Read-only */ 
    8 int refcount; /* Read-mostly */ 
    /* This structure also contains private fields not shown 
    here */} SDL_Surface; 

#endif