clang 和 gcc 是否可以选择禁止向对象发送未定义消息的警告?如果是这样,标志是什么?
使用铿锵声3.1:
test.mm:51:14: warning: instance method '-dfs_path:' not found (return type defaults to 'id')
([pathfinder dfs_path: graph, @[ NUM(start) ], NUM(goal), NUM(max_steps)])
~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
使用 gcc 4.2.1:
test.mm: In function ‘void test_path(objc_object*, objc_object*, int, int, int, BOOL)’:
test.mm:84: warning: no ‘-dfs_path:’ method found
test.mm:84: warning: (Messages without a matching method signature
test.mm:84: warning: will be assumed to return ‘id’ and accept
test.mm:84: warning: ‘...’ as arguments.)
test.mm:84: warning: no ‘-dfs_path:’ method found
基本上,有问题的方法是在 MacRuby 中生成的,因此 Objective C 编译器在编译时并不知道它们。