首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >换行/注释注释

换行/注释注释
EN

Stack Overflow用户
提问于 2013-04-15 02:25:57
回答 2查看 66关注 0票数 0

我复制了这个结构

代码语言:javascript
运行
复制
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;

并尝试使用/*和*/以及代码的开头和结尾进行注释(换行),但这不起作用。

代码语言:javascript
运行
复制
/*
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;
*/

有谁可以帮我?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-04-15 02:29:55

使用

代码语言:javascript
运行
复制
#if 0
blah
#endif

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

( /**/不工作的原因是,一旦在注释中,第一个*/将结束它,因此/* blah /* explanation */ more */将在explanation之后结束,而不是more)

票数 3
EN

Stack Overflow用户

发布于 2013-04-15 02:31:05

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

代码语言:javascript
运行
复制
#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
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16002704

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档