我复制这个结构
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 :(得分:3)
使用
#if 0
blah
#endif
“注释掉”那样的大块代码。它还具有嵌套的好处。
(/*
和*/
无效的原因是因为一旦在评论中,第一个 */
将结束它,因此{{1 }}将在/* blah /* explanation */ more */
之后结束,不是 explanation
)
答案 1 :(得分: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