Does it even matter? Const before or const after? I'm guessing that whether I put const
before or after CGFloat
it makes the value of CGFloat
constant, but what about the pointer? Is this right for Objective-C:
// Example.h
extern CGFloat const kPasscodeInputBoxWidth;
// Example.m
CGFloat const kPasscodeInputBoxWidth = 61.0f;
It can go either before or after. In the case of a pointer, what matters is whether the const
ends up before or after the asterisk:
const int *a; // pointer to const int -- can't change what a points at
int const *a; // same
int *const a; // const pointer to int -- can't change the pointer itself.
// Note: must be initialized, since it can't be assigned.