Comparison between pointer and integer (cocoa)

Posted by Cal S on Stack Overflow See other posts from Stack Overflow or by Cal S
Published on 2010-06-13T07:07:12Z Indexed on 2010/06/13 7:12 UTC
Read the original article Hit count: 253

Filed under:
|
|

Hi, I'm just learning cocoa (coming from C#) but I'm getting a strange error for something that seems really simple... (charsSinceLastUpdate>=36)

    #import "CSMainController.h"

@implementation CSMainController
//global vars
int *charsSinceLastUpdate = 0;
NSString *myString = @"Hello world";
//

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
...
}

//other functions
- (void)textDidChange:(NSNotification *)aNotification {
    NSLog(@"charsSinceLastUpdate=%i",charsSinceLastUpdate);
    if (charsSinceLastUpdate>=36) { // <- THIS line returns the error: Comparison between pointer and integer
        charsSinceLastUpdate=0;
        [statusText setStringValue:@"Will save now!"];
    } else {
        charsSinceLastUpdate++;
        [statusText setStringValue:@"Not saving"];
    }

}

//my functions
- (void)showNetworkErrorAlert:(BOOL)showContinueWithoutSavingOption {
...
}
//

@end

Any help would be appreciated, thanks!

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about xcode