为什么K&R风格中Ken用名而Rtichie用姓

intro

在看vim缩进相关的代码中,有些地方的注释特意强调了对于“K&R style function"相关的内容。例如,在find_decl()函数的注释中。

///@file: normal.c
         // For finding a local variable and the match is before the "{" or
          // inside a comment, continue searching.  For K&R style function
          // declarations this skips the function header without types.

这个注释的具体意义不重要,重要的是注意到一个奇怪的地方:为什么Ken Thompson的缩写是名字K的首字母;而Dennis Ritchie的缩写使用的是姓Ritchie的首字母。

答案

奇怪的是网上并没有这个问题的答案,因为K并不是Ken的首字母,而是另一个大佬Brian Kernighan的姓Kernighan的首字符。

更重要的是,Kernighan和Ritchie合著了经典的《C programming language》这本C语言的经典书籍,只是我孤陋寡闻了。

outro

和“先问是不是,再问为什么”相反,通常是因为问了为什么,才会知道是不是、

posted on 2024-08-20 20:15  tsecer  阅读(3)  评论(0编辑  收藏  举报

导航