September 6, 2009

If you haven’t read the Ars Technica review of Snow Leopard yet, you should do it!! It’s got a great break-down of the new features and even talks about the changes to the development environment. After seeing the breakdown of the new compiler shipped (Clang LLVM) with Snow Leopard, I fired up Xcode 3.2 and opened up my Plexer source code.

Build and Analyze… waiting, 17 issues!!! Oops!

Here’s a quick shot of one of the issues that it found:

Clang at Work

So I’m sure all of you seasoned Objective-C programmers are laughing out there at me right now, but what can I say, I’m still learning this whole retain-count memory management. 🙂

Needless to say, I was astounded that the compiler was able to figure this out for me. This will obviously be extremely handy for all of those new Objective-C programmers (and even veteran) that forget to release that memory when you’re done with it.

Clang is able to find other types of issues as well, like coding standards violations. For instance, I had a message named withName:(NSString*) and Clang realized that I was returning an instance and control of the memory and that my message name didn’t start with ‘copy’, ‘new’ or ‘alloc’.

Overall, I was actually quite impressed at what Clang was able to do. So yeah, if you have Snow Leopard and you’re a developer, you should definitely switch your projects to use the Clang compiler (unless your projects are C++, Clang doesn’t currently support that language).

For more Clang information, check it out here:

%d bloggers like this: