What is the difference of the following const definition

static means that the variable is accessible only within the compilation unit it's declared in - essentially this source file. const means its value can never change. You can use one, both, or none depending on what you're looking for.


In C, the static keyword, used outside a function, is used to declare a symbol that will be accessible only from the file in which it's declared. Kind of «private» global variables.

The const keyword means «constant». Read, the value can't be modified. Note the two statements are different:

const int * x;
int * const x;

The first one defines a pointer to a constant integer (its value can't be modified, but it can point to something else). The second one defines a constant pointer to an integer (the pointer value can't be modified, but the value of the int may be). So you can perfectly have:

const int * const x;

So in your case:

static NSString* kFetcherCallbackThreadKey = @"_callbackThread";

A pointer to a NSString instance that will be accessible only from the file in which it's declared.

static NSString* const kFetcherCallbackRunLoopModesKey = @"_runLoopModes";

A constant pointer to a NSString instance that will be accessible only from the file in which it's declared.

NSString* const kFetcherRetryInvocationKey = @"_retryInvocation";

A constant pointer to a NSString instance that may be accessed from other files of your project.

static const NSUInteger kMaxNumberOfNextLinksFollowed = 25;

A constant integer that will be accessible only from the file in which it's declared.