delphi - {}和//的区别?

标签 delphi delphi-7

{}// 都用于根据大小添加注释吗?

很抱歉问了这个愚蠢的问题,但是当我尝试用 google 搜索“{}//Delphi”时,我会得到 Delphi.com 和 Wikipidia 的链接以获取随机信息。

最佳答案

可以通过三种方式向 delphi 源文件添加注释:

{ This can be a single line comment }

{   but it can also span multiple lines
}

// Single line comment

单行注释在行尾结束。其他评论都有自己的结局。

(* This also can be a single comment *)

(* And it also can span multiple lines
*)

{ Can be used to comment out code containing a (* comment *)
  // Or one of those 
}
(* Can be used to coment out code containing a { comment } 
   // Or one of those 
 *)

// And this can contain the (* Single *) version of the { other } comments.

没有什么真正的区别。但有些人保留一种注释风格来(临时)注释掉代码。因为你不能嵌套相同的类型,但可以嵌套不同的类型。

琐事,包含 (* *) 注释是为了支持没有 { 和 } 的(真正的)旧键盘。您还可以使用 (. .) 表示 []。

关于delphi - {}和//的区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21856605/

相关文章:

delphi - 将两个或多个条件组合在一个 if 语句中

delphi - 如何对DATAGrid header 高度进行“固定”值?

Delphi - 获取Windows的默认非unicode字符集

delphi - Russell Libby 的 Pipes 组件

delphi - 使用 tlist 的完整 Delphi 代码中的内存泄漏

delphi - 确定是否为特定单元打开模式对话框 - Delphi

delphi - OpenDialog 在 alt+tab 上位于模态窗口后面

.net - 使用 MSBuild 构建 Delphi 项目是否会创建 .Net 依赖项?

.net - 有没有办法创建 .net 用户控件以便在 delphi 表单上使用它们?

delphi - 如何将对象转换为接口(interface)(Delphi 中的通用类型约束)