什么是K& R 1-23?我的K& R(两个版本)副本目前都是几英里 。 C99(K& R版本都没有)增加C ++ - 风格(或 BCPL风格的软件考古学家)评论,由//和 引入的行结束。有一些非常模糊的案例 其中//注释的引入导致有效的C90程序 成为具有不同含义的有效C99程序。我不记得 确切的细节,但它涉及一个分部操作员立即 后跟一个旧式/ * ... * /评论,其中以下行 仔细构建,使程序合法,无论第一个'/'' 是一个除法运算符还是//注释的第一个字符 分隔符。 如果/ *或//出现在字符串或字符文字中,那么它不会引发评论。你的例子: / *这里的东西* / / *这里有更多的东西* / 显然是两条评论,就是这样: / *这里的东西* // *这里有更多的东西* / 除此之外,我不确定你在问什么。 - Keith Thompson(The_Other_Keith) ks***@mib.org < http: //www.ghoti.net/~kst> 圣地亚哥超级计算机中心< *> < http://users.sdsc.edu/~kst> 我们必须做点什么。这是事情。因此,我们必须这样做。What is K&R 1-23? My copies of K&R (both editions) are several milesaway at the moment.C99 (which neither edition of K&R covers) adds C++-style (orBCPL-style for software archeologists) comments, introduced by // andterminated by the end of the line. There are some very obscure caseswhere the introduction of // comments causes a valid C90 program tobecome a valid C99 program with a different meaning. I don''t rememberthe exact details, but it involves a division operator immediatelyfollowed by an old-style /* ... */ comment, with the following linecarefully contructed to make the program legal whether the first ''/''is a division operator or the first character of a // commentdelimiter.If a /* or // appears within a string or character literal, it doesn''tintroduce a comment. Your example:/* stuff here */ /* more stuff here */is obviously two comments, as is this:/* stuff here *//* more stuff here */Beyond that, I''m not sure what you''re asking.--Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>We must do something. This is something. Therefore, we must do this. 嗨Keith, 嗯,这是有道理的。我会玩弄它。谢谢。Hi Keith,Well, that makes sense. I will play around with it. Thank you. 编写程序删除C程序中的所有注释。不要忘记正确处理引用的字符串和字符常量。 C评论不要嵌套。 Write a program to remove all comments from a C program. Don''t forget to handle quoted strings and character constants properly. C comments do not nest. 练习是指C语言的一个版本,它不支持支持//评论 - 当然,如果你愿意的话,你可以在你的 自己的程序中处理它们。您甚至可以考虑使用 命令行选项来告诉您程序是否处理//评论。 - Keith Thompson(The_Other_Keith) ks***@mib.org < http://www.ghoti.net/~kst> 圣地亚哥超级计算机中心< *> < http://users.sdsc.edu/~kst> 我们必须做点什么。这是事情。因此,我们必须这样做。The exercise refers to a version of the C language that doesn''tsupport // comments -- though of course you can handle them in yourown program if you wish. You might even consider having acommand-line option to tell you program whether to handle // comments.--Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>We must do something. This is something. Therefore, we must do this. 这篇关于老问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-21 15:13