views:

151

answers:

2

A simple google search for:

CGRect + C

or

CGRect in C

brings back only Apple, iPhone, and Objective-C websites. However, I remember hearing that Core Graphics was part of C at my university. Did I hear incorrectly, or is CGRect something that I can use in C, or even C++ as it's Object oriented?

+2  A: 

CGRect is defined in Carbon, which is plain C:

#import <Carbon/Carbon.h>
int main()
{
    CGRect r;
}

If you look at preprocessor output you'll notice CGRect is just a plain struct:

$ gcc -E test.c | grep -A 3 "struct.*CGRect"
struct CGRect {
  CGPoint origin;
  CGSize size;
};
typedef struct CGRect CGRect;
diciu
More accurately, it's defined in Core Graphics, which both Carbon and Cocoa depend on.
Peter Hosey
+2  A: 

Well, you can use it in C or C++, but only on Apple platforms (Mac or iPhone). It's not a part of the standard C environment, if that's what you were asking.

Mark Bessey