什么是" K"站在可可常量名 [英] What does the "k" stand for in Cocoa constant names
问题描述
可能重复:结果
<一href=\"http://stackoverflow.com/questions/675816/what-does-the-k-$p$pfix-indicate-in-apples-apis\">What请问'K'preFIX表明苹果的API?结果
<一href=\"http://stackoverflow.com/questions/1230854/objective-c-why-do-constants-start-with-k\">Objective Ç - 为什么常数以K开头
例如,<一个href=\"http://developer.apple.com/library/mac/#documentation/AudioToolbox/Reference/AudioFormatServicesReference/Reference/reference.html%23//apple_ref/doc/uid/TP40007286-CH5-SW1\"相对=nofollow>结果codeS音频格式服务定义的:
-
kAudioFormatUnspecifiedError
-
kAudioFormatUnsupportedPropertyError
- 等...
什么是领导ķ立场?我总是假定关键,因为这样的常数常常用作在字典的键,但这些结果codeS是其中常数只是一个返回值,而不是一个例子(尽可能的API的客户端可以确定)的关键。
What does that leading k stand for? I've always assumed key, since such constants are often used as the keys in dictionaries, but those result codes are an example of where the constant is just a return value, not (as far as a client of the API can determine) a key.
推荐答案
我想,它只是代表k'onstant,其中k的使用,因为'C'已经被常用来表示的类的或匈牙利命名法的字符的。
I imagine that it merely stands for 'k'onstant, where 'k' is used because 'c' is already commonly used to indicate class or in Hungarian notation character.
的使用是有历史precedent;使用'K'早袖珍计算器来表示的恒定模式的(其中 =
的反复操作多次最后一次操作),因为'C'用于清除的
The usage has historical precedent; early pocket calculators used 'k' to indicate constant mode (where repeated operation of =
repeated the last operation) because 'c' was used for clear.
这篇关于什么是&QUOT; K&QUOT;站在可可常量名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!