Conflict warning.. warning: conflicting types for '-(NSRect)


#1

How come I had to change ??? to get a clean compile??

code was:

-(NSRect)rectForPage:(int)i

to

thanks…
Ian


#2

[quote=“IanDMah”]How come I had to change ??? to get a clean compile??

code was:

-(NSRect)rectForPage:(int)i

to

thanks…
Ian[/quote]

because thats how it’s defined in the NSView.h header

% grep rectForPage /System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSView.h
- (NSRect)rectForPage:(NSInteger)page;

(or see NSView Class Reference)

I guess int works because NSInteger is actually int when you build your app for i386 (which was default not so long ago IIRC) instead of x86_64, see Foundation Data Types Reference:

[quote]#if LP64 || TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
typedef long NSInteger;
#else
typedef int NSInteger;
#endif[/quote]

But anyway, you’re right, this is misleading because I’ve also seen -(NSRect)rectForPage:(int)… in Apple’s Documentation, maybe we should click "It’s good, but… " at the bottom of the page next time we see this :slight_smile:

HTH