Skip to content

Instantly share code, notes, and snippets.

// clang -ggdb -arch x86_64 -Wl,-rpath,/Users/jordan/Build/JBBAdditions/Release -F/Users/jordan/Build/JBBAdditions/Release -o test test.m -framework JBBAdditions -framework Cocoa
// clang -arch i386 -arch x86_64 -Wl,-rpath,/Users/jordan/Build/JBBAdditions/Release -F/Users/jordan/Build/JBBAdditions/Release -o test test.m -framework JBBAdditions -framework Cocoa
#import <stdlib.h>
#import <stdio.h>
#import <Cocoa/Cocoa.h>
#import <JBBAdditions/JBBAdditions.h>
// clang -arch i386 -arch x86_64 -Wl,-rpath,/Users/jordan/Build/JBBAdditions/Release -F/Users/jordan/Build/JBBAdditions/Release -o test test.m -framework JBBAdditions -framework Cocoa
#import <stdlib.h>
#import <stdio.h>
#import <Cocoa/Cocoa.h>
#import <JBBAdditions/JBBAdditions.h>
int main(int argc, char *argv[]) {
23 jordan@thetourist ~/Tests/block_typecast_testcase/output/test2.m > cat _opt_llvm_bin_clang.txt
test2.m:76:76: error: incompatible block pointer types sending 'int (^)(id<JBBNodeProtocol>, id<JBBNodeProtocol>)', expected 'JBBComparisonBlock' (aka 'NSComparisonResult (^)(id, id)')
JBBPriorityQueue *localQueue = [[JBBPriorityQueue alloc] initWithBlock:^(id <JBBNodeProtocol> lhs, id <JBBNodeProtocol> rhs) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 diagnostic generated.
--- test2.m 2010-01-26 14:44:47.000000000 -0600
+++ test3.m 2010-01-25 20:18:22.000000000 -0600
@@ -1,4 +1,4 @@
-// /Developer/usr/bin/clang -arch x86_64 -std=gnu99 -fobjc-gc-only -o test2 -F. -Wl,-rpath,. test2.m -framework Foundation -framework JBBPriorityQueue -framework JBBAdditions
+// /Developer/usr/bin/clang -arch x86_64 -std=gnu99 -fobjc-gc-only -o test3 -F. -Wl,-rpath,. test3.m -framework Foundation -framework JBBPriorityQueue -framework JBBAdditions
#import <objc/objc-auto.h>
#import <dispatch/dispatch.h>
@@ -16,7 +16,6 @@
Tests running (compiler exit codes printed)...
0 is passing, anything else is an error...
These tests are verifying the presence of objc_startCollectorThread()...
Output for the following tests is in output/test1.m/ansi...
18 jordan@thetourist /tmp > g++ -fobjc-gc-only -o test test.mm
test.mm: In function ‘int main(int, char**)’:
test.mm:4: error: ‘objc_collectingEnabled’ was not declared in this scope
test.mm:5: error: ‘objc_startCollectorThread’ was not declared in this scope
// gcc -fobjc-gc-only -o test3 test3.m -framework Cocoa && ./test3
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[]) {
NSPredicate *myPred = [NSPredicate predicateWithFormat:@"NOT (SELF in %@)" argumentArray: [NSArray arrayWithObjects:[NSArray arrayWithObjects:@"one", @"two", @"three", nil], nil]];
NSLog(@"test3 finished running");
return 0;
}
// gcc -fobjc-gc-only -o test2 test2.m -framework Cocoa && ./test2
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[]) {
NSArray *arrayOne = [NSArray arrayWithObjects:@"one", @"two", @"three", nil];
NSArray *arrayTwo = [NSArray arrayWithObjects:arrayOne, nil];
NSPredicate *myPred = [NSPredicate predicateWithFormat:@"NOT (SELF in %@)", arrayTwo];
// gcc -fobjc-gc-only -o test1 test1.m -framework Cocoa && ./test1
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[]) {
NSArray *arrayOne = [NSArray arrayWithObjects:@"one", @"two", @"three", nil];
NSArray *arrayTwo = [NSArray arrayWithObjects:arrayOne, nil];
NSPredicate *myPred = [NSPredicate predicateWithFormat:@"NOT (SELF in %@)" argumentArray: arrayTwo];
# BinaryHeap and PriorityQueue based on my Objective-C version
class JBBBinaryHeap
def initialize(isMaxHeap = false)
@mStorage = []
@mCompareProc = (isMaxHeap) ? lambda { |x, y| x < y } : lambda { |x, y| x > y }
end
def add(objectToAdd)
@mStorage.push(nil)