1

Many constants in CoreFoundation have the kCF prefix. What does it mean?

enter image description here enter image description here

Jens
  • 67,715
  • 15
  • 98
  • 113
Allen
  • 6,745
  • 5
  • 41
  • 59

2 Answers2

3

In both OS X Frameworks and iOS Frameworks you find a list of system frameworks together with the key prefixes used by the classes, methods, functions, types, or constants of the framework.

This list contains

Name                      Prefix
--------------------------------
...
CFNetwork.framework       CF
...
CoreFoundation.framework  CF
...

So there are actually several frameworks using the "CF" prefix, but Core Foundation is the most "prominent" one.

The "k" prefix for constants is documented in Naming Conventions in "Introduction to Core Foundation Design Concepts" (emphasis added):

A major programming-interface convention in Core Foundation is to use the name of the opaque type that is most closely related to a symbol as the symbol’s prefix. For functions, this prefix identifies not only the type to which the function “belongs” but usually the type of object that is the target of the function’s action. (An exception to this convention are constants, which put “k” before the type prefix.)

As an example, kCFAllocatorMalloc is a constant related to the CFAllocator type which is part of the Core Foundation framework.

Martin R
  • 529,903
  • 94
  • 1,240
  • 1,382
0

k stands for Constant & CF stands for Core Foundation

Nilesh Patel
  • 6,318
  • 1
  • 26
  • 40