英文:
What do the fmt functions stand for?
问题
包名fmt
代表"format"(格式化)。我对包内的函数名感到很困惑。以下几个是否正确?
Sprint
代表"字符串打印"?Sscan
代表"字符串扫描"?Fprint
代表"格式化打印"?Fscan
代表"格式化扫描"?Printf
代表"打印格式"?
英文:
The package name fmt
stands for "format". I am quite confused by the function names inside the package. Are the following correct?
Sprint
stands for "string print"?Sscan
stands for "string scan"?Fprint
stands for "format print"?Fscan
stands for "format scan"?Printf
stands for "print format"?
答案1
得分: 4
或多或少。除了F*
这些与文件相关的事物之外,
- Fprint代表“文件打印”
- Fscan代表“文件扫描”
其中,“文件”表示“IO对象”。
这些名称可能看起来令人困惑,但实际上它们与C标准库中的名称相匹配,该标准库存在于上个世纪! :)由于Go定位为系统编程语言,模仿其他系统语言的API是很自然的。
英文:
More or less. Except that F*
things are file related
- Fprint stands for "file print"
- Fscan stands for "file scan"
Where "file" means "an IO object".
Those names might look confusing, but actually they match names from C stdlib, which exists since the last millennium! As Go is positioned as system programming language, it is natural that they mimic API of the other system language.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论