2013-04-14 326 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