Delphi XE5教程12:注释和编译器指示字

内容源自Delphi XE5 UPDATE 2官方帮助《Delphi Reference》,本人水平有限,欢迎各位高人修正相关错误!
也欢迎各位加入到Delphi学习资料汉化中来,有兴趣者可QQ:34484690@qq.com

3 Comments and Compiler Directives

3注释和编译器指示字

Comments are ignored by the compiler, except when they function as separators (delimiting adjacent tokens) or compiler directives.

注释将被编译器忽略,除非它们用作分隔符(隔开相邻的token)或编译器指示字。

There are several ways to construct comments:

有以下几种方式创建注释:

 { Text between left and right braces is a comment. }

 

{  由一对花括号所包含的文字构成注释  }

 

 (* Text between left-parenthesis-plus-asterisk and an

  asterisk-plus-right-parenthesis is also a comment *)

 

(*  由左圆括号加一个星号和

一个星号加右圆括号之间的文字也构成注释 *)

 // Text between double-slash and end of line is a comment.

 

//  由两个斜杠开始直到这一行的结束,这里的文字是注释

Comments that are alike cannot be nested. For instance, (*{}*) will. This latter form is useful for commenting out sections of code that also contain comments.

相同方式的注释不能嵌套。例如,(*{}*)可以。这后一种形式是注释掉的代码部分还包含有用的注释。

Here are some recommendations about how and when to use the three types of comment characters:

以下是有关如何以及何时使用三种类型的注释字符的一些建议:

  • Use the double-slash (//) for commenting out      temporary changes made during development. You can use the Code Editor's      convenient CTRL+/ (slash) mechanism to quickly insert the double-slash      comment character while you are working.

使用双斜线(//)注释掉开发过程中做出的临时变化。在您工作期间,您可以使用代码编辑器的快捷键Ctrl +/(斜杠)来快速插入双斜线注释字符。

  • Use the parenthesis-star "(*...*)" both      for development comments and for commenting out a block of code that      contains other comments. This comment character permits multiple lines of      source, including other types of comments, to be removed from      consideration by the compiler.

使用括号星“(*...*)”既为开发的注释和注释掉的代码块,它包含其他注释。此注释字符允许多行源代码,包括其他类型的注释,从考虑由编译器被删除。

  • Use the braces ({}) for in-source documentation that      you intend to remain with the code.

使用大括号({})在源文档中注释你打算继续保留的代码。注意: {}不能嵌套。

 

A comment that contains a dollar sign ($) immediately after the opening { or (* is a compiler directive. For example,

若$  符紧跟在  { 或  (* 之后,则这里的注释是编译器指示字。例如

 {$WARNINGS OFF}


tells the compiler not to generate warning messages.

它告诉编译器不要产生警告信息。

转载于:https://www.cnblogs.com/taukinfo/p/3570284.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值