Skip to content

Instantly share code, notes, and snippets.

@markd2
Created October 29, 2012 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save markd2/3974798 to your computer and use it in GitHub Desktop.
Save markd2/3974798 to your computer and use it in GitHub Desktop.
Exploring the 'atomic' keyword in properties.
#import <Foundation/Foundation.h>
// clang -g -Wall -framework Foundation -o atomic atomic.m
// gcc -g -Wall -framework Foundation -o atomic atomic.m
@interface Blah : NSObject
@property (assign, NS_NONATOMIC_IOSONLY) NSInteger frobnozzle;
@property (assign, ) NSInteger commaAtEnd;
// @property (, assign) NSInteger commaAtBeginning; // Syntax error
@property (atomic, assign) NSInteger blah; // complains in gcc
@end
@implementation Blah
#define GET_WARNING 0
#if GET_WARNING
- (NSInteger) blah {
return _blah;
} // blah
#endif
@end
int main (void) {
return 0;
} // main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment