筑巢的 [英] nesting coments

查看:62
本文介绍了筑巢的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对这里的圣人有疑问。


comp.lang.c常见问题说:


20.20:为什么要' 'C评论巢?它们是否合法引用

字符串?


答:C评论不会嵌套,因为PL / I的评论也不是。

字符序列/ *和* /在双b / b
引用的字符串中不是特别的。

所以后面提到的原因是什么语言

不嵌套评论?这纯粹是一个设计选择吗?

即,它不是很难实现

它只是非常难看?


我,我自己,不想要嵌套评论,因为

它打开了允许不必要的混乱

和混淆的大门。但是我很好奇实际的原因

背后禁止它。


-

nethlek

I have a question for the sages here.

the comp.lang.c faq says:

20.20: Why don''t C comments nest? Are they legal inside quoted
strings?

A: C comments don''t nest because PL/I''s comments don''t either. The
character sequences /* and */ are not special within double-
quoted strings.
so what is the reason for the latter mentioned language
to not nest comments? Was it purely a design choice?
i.e., it wasn''t that it was difficult to implement
it was just horribly ugly?

I, myself, wouldn''t want nested comments because
it opens doors for allowing unnecessary cluttering
and conflation. But I''m curious as to the actual reason
behind disallowing it.

--
nethlek

推荐答案

2004年4月8日16:04:31 -0700, ne * ****@tokyo.com (Mantorok Redgormor)写道:
On 8 Apr 2004 16:04:31 -0700, ne*****@tokyo.com (Mantorok Redgormor) wrote:
我对这里的圣人有疑问。

comp。 lang.c faq说:

20.20:为什么C评论没有嵌套?它们是否合法引用
字符串?

答:C评论不会嵌套,因为PL / I的评论也不是。
字符序列/ *和* /在双引号字符串中并不特殊。

所以后面提到的语言是什么原因
不能嵌套评论?它纯粹是一种设计选择吗?
即不是难以实现
它只是非常难看?

我,我自己,不会想要嵌套的评论,因为它打开了允许不必要的混乱和混淆的大门。但是我很好奇在禁止它背后的实际原因。
I have a question for the sages here.

the comp.lang.c faq says:

20.20: Why don''t C comments nest? Are they legal inside quoted
strings?

A: C comments don''t nest because PL/I''s comments don''t either. The
character sequences /* and */ are not special within double-
quoted strings.
so what is the reason for the latter mentioned language
to not nest comments? Was it purely a design choice?
i.e., it wasn''t that it was difficult to implement
it was just horribly ugly?

I, myself, wouldn''t want nested comments because
it opens doors for allowing unnecessary cluttering
and conflation. But I''m curious as to the actual reason
behind disallowing it.




快速扼杀失控评论在萌芽?就个人而言,我一直希望

能够使用嵌套注释,所以我相信我有BDS C支持它们

(令人惊讶的是那个编译器有多少特定功能我不能确切地记住
。但是在同一时间(或者至少在人们开始抱怨之后不久),我提供了一个诊断指向

外层失控评论的/ start / if编译器达到EOF并且在评论中仍然是

。在没有该诊断能力的情况下,特征可以是特征。会有噩梦......

-leor

-

Leor Zolman --- BD软件--- www.bdsoft.com

现场C / C ++,Java,Perl和Unix培训

C ++用户:下载BD Software的免费STL错误消息解密器:
www.bdsoft.com/tools/stlfilt.html


Mantorok Redgormor写道:
Mantorok Redgormor wrote:

.... snip ...
我,我自己,不想要嵌套评论,因为它打开了允许允许的门不必要的混乱和混乱。但是我很好奇不允许它背后的实际原因。
.... snip ...
I, myself, wouldn''t want nested comments because it opens doors
for allowing unnecessary cluttering and conflation. But I''m
curious as to the actual reason behind disallowing it.




可能因为回到史前时代它更容易/>
解析。我们读取序列/ *,丢弃它,并读取源

,直到序列* /为止。出现,返回一个空白。没有

需要计算东西,保存东西等等。


解析起来更容易。


- -

Chuck F(cb********@yahoo.com)(cb********@worldnet.att.net)

可用于咨询/临时嵌入式和系统。

< http://cbfalconer.home.att.net>使用worldnet地址!



Probably because back in pre-historic times it was much easier to
parse. We read the sequence "/*", discard it, and read source
until the sequence "*/" appears, returning a single blank. No
need to count things, save things, whatever.

It remains easier to parse.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!


Leor Zolman< le ** @ bdsoft.com>写道:
Leor Zolman <le**@bdsoft.com> writes:
就我个人而言,我一直希望能够使用嵌套的评论,
Personally, I always wanted to be able to use nested comments,




为什么?你可能想在评论中说什么(即在

解释性文字中)需要嵌套评论?


唯一的原因我能看出为什么一个将嵌套评论暂时

" comment out"代码部分。为此,我更喜欢#if 0 ... #endif,

确实有巢。


Martin

-

, - 。 Martin Dickopp,德国德累斯顿,=, - _-。 =。

/, - ) http://www.zero -based.org/ ((_ /)oo(\_))

\` - ''` - ''(。)` - ''

` - 。 Debian,GNU操作系统的一种变体。 \_ /



Why? What would you possibly want to say in a comment (i.e. in an
explanatory text) that requires nested comments?

The only reason I can see why one would nest comments is to temporarily
"comment out" code sections. For that, I prefer #if 0 ... #endif, which
does nest.

Martin
--
,--. Martin Dickopp, Dresden, Germany ,= ,-_-. =.
/ ,- ) http://www.zero-based.org/ ((_/)o o(\_))
\ `-'' `-''(. .)`-''
`-. Debian, a variant of the GNU operating system. \_/


这篇关于筑巢的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆