5 ms·
Poor as it is, I think the original intention of the Mac version was to avoid buffer overflows. You can potentially screw up with the iPhone code by doing:
by alextgordon 17y ago
Poor as it is, I think the original intention of the Mac version was to avoid buffer overflows. You can potentially screw up with the iPhone code by doing:
const CGFloat *rgba = CGColorGetComponents([fg CGColor]);
CGFloat a = rgba[4]; //Crash!
However, you do have a point in that explicit data structs are better than implicit ones. I would have chosen this API:
typedef struct {
CGFloat r;
CGFloat g;
CGFloat b;
CGFloat a;
} UIRGBAColor;
//...
UIRGBAColor rgba = [fg rgbaComponents];