fbpx
维基百科

Gotcha (编程)

Gotcha(发音[英][ˈɡɔtʃə][美][ˈɡɑtʃə]),在计算机编程领域中是指在系统或程序程序设计语言中,合法有效,但是會誤解意思的构造,程式容易造成错误,或是一些易于使用但其结果不如期望的構造。字面上是got you的简写,常用于口语,直译为: “逮着你了”、“捉弄到你了 ”、“你中计了” 、“骗到你了”。[1]

例子 编辑

一个典型的gotcha是C/C++中的:

if (a = b) code; 

大多数情形,编程者的意图是:

if (a == b) code; 

现代编译器在这种情形(条件表达式中是个赋值而不是逻辑比较)会产生一条编译警告消息。通行的编程风格建议[2]在比较表达式的左侧是个常量,如: 42 == x 而不是 x == 42,参见尤達條件式

相關條目 编辑

参考文献 编辑

  1. ^ Gotcha definition at The Jargon File. [2018-11-02]. (原始内容于2015-12-20). 
  2. ^ "VOID EXP21-C. Place constants on the left of equality comparisons". [2018-11-02]. (原始内容于2016-10-11). 

进一步阅读 编辑

  • Stephen C. Dewhurst. C++ Gotchas (Avoiding Common Problems in Coding and Design). Addison-Wesley. 2003. ISBN 0321125185. 

外部链接 编辑

  • C Traps and Pitfalls (页面存档备份,存于互联网档案馆) by Andrew Koenig
  • A programmer's guide to avoiding and correcting ninety-nine of the most common, destructive, and interesting C++ design and programming errors, by Stephen C. Dewhurst

gotcha, 编程, gotcha, 发音, ˈɡɔtʃə, ˈɡɑtʃə, 在计算机编程领域中是指在系统或程序, 程序设计语言中, 合法有效, 但是會誤解意思的构造, 程式容易造成错误, 或是一些易于使用但其结果不如期望的構造, 字面上是got, you的简写, 常用于口语, 直译为, 逮着你了, 捉弄到你了, 你中计了, 骗到你了, 目录, 例子, 相關條目, 参考文献, 进一步阅读, 外部链接例子, 编辑一个典型的gotcha是c, 中的, code, 大多数情形, 编程者的意图是, code, 现代编译器. Gotcha 发音 英 ˈɡɔtʃe 美 ˈɡɑtʃe 在计算机编程领域中是指在系统或程序 程序设计语言中 合法有效 但是會誤解意思的构造 程式容易造成错误 或是一些易于使用但其结果不如期望的構造 字面上是got you的简写 常用于口语 直译为 逮着你了 捉弄到你了 你中计了 骗到你了 1 目录 1 例子 2 相關條目 3 参考文献 4 进一步阅读 5 外部链接例子 编辑一个典型的gotcha是C C 中的 if a b code 大多数情形 编程者的意图是 if a b code 现代编译器在这种情形 条件表达式中是个赋值而不是逻辑比较 会产生一条编译警告消息 通行的编程风格建议 2 在比较表达式的左侧是个常量 如 42 x 而不是 x 42 参见尤達條件式 相關條目 编辑易用性 防呆参考文献 编辑 Gotcha definition at The Jargon File 2018 11 02 原始内容存档于2015 12 20 VOID EXP21 C Place constants on the left of equality comparisons 2018 11 02 原始内容存档于2016 10 11 进一步阅读 编辑Stephen C Dewhurst C Gotchas Avoiding Common Problems in Coding and Design Addison Wesley 2003 ISBN 0321125185 外部链接 编辑查看维基词典中的词条 gotcha C Traps and Pitfalls 页面存档备份 存于互联网档案馆 by Andrew Koenig C Gotchas A programmer s guide to avoiding and correcting ninety nine of the most common destructive and interesting C design and programming errors by Stephen C Dewhurst 取自 https zh wikipedia org w index php title Gotcha 编程 amp oldid 69910860, 维基百科,wiki,书籍,书籍,图书馆,

文章

,阅读,下载,免费,免费下载,mp3,视频,mp4,3gp, jpg,jpeg,gif,png,图片,音乐,歌曲,电影,书籍,游戏,游戏。