Skip to content

Instantly share code, notes, and snippets.

@toulouse
Created May 22, 2014 16:42
Show Gist options
  • Save toulouse/8a4bfab43a67533d33c8 to your computer and use it in GitHub Desktop.
Save toulouse/8a4bfab43a67533d33c8 to your computer and use it in GitHub Desktop.
//
// Foo.h
// InternCheck
//
// Created by Andrew Toulouse on 5/23/14.
// Copyright (c) 2014 Andrew Toulouse. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface Foo : NSObject
@end
//
// Foo.m
// InternCheck
//
// Created by Andrew Toulouse on 5/23/14.
// Copyright (c) 2014 Andrew Toulouse. All rights reserved.
//
#import "Foo.h"
static NSString const *aConst1 = @"ASDF";
static NSString const *aConst2 = @"ASDF";
NSString *aConst3 = @"ASDF";
@implementation Foo
+ (void)load
{
NSLog(@"aConst1: %p aConst2: %p aConst3: %p", aConst1, aConst2, aConst3);
}
@end
//
// main.m
// InternCheck
//
// Created by Andrew Toulouse on 5/23/14.
// Copyright (c) 2014 Andrew Toulouse. All rights reserved.
//
#import <Foundation/Foundation.h>
static NSString const *aConst4 = @"ASDF";
static NSString const *aConst5 = @"ASDF";
int main(int argc, const char * argv[])
{
@autoreleasepool {
NSLog(@"aConst4: %p aConst5: %p", aConst4, aConst5);
}
return 0;
}
@toulouse
Copy link
Author

Output:

2014-05-23 01:41:29.715 InternCheck[8312:303] aConst1: 0x100001168 aConst2: 0x100001168 aConst3: 0x100001168
2014-05-23 01:41:29.717 InternCheck[8312:303] aConst4: 0x100001168 aConst5: 0x100001168
Program ended with exit code: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment