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;
*/

谁能帮我?

4

2 回答 2

3

采用

#if 0
blah
#endif

像这样“注释掉”大块代码。它还具有可嵌套的优点。

(原因/**/不起作用是因为一旦在评论中,第一个 */将结束它,所以/* blah /* explanation */ more */会在之后结束explanation而不是 more

于 2013-04-14T18:29:55.167 回答
1

嵌套注释不起作用,但您可以让预处理器跳过结构

#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
于 2013-04-14T18:31:04.577 回答