Dev tools, Xcode

Xcode preprocess assistant

xcode_preprocess_assistant

A very cool Xcode feature I can across is the preprocess assistant. It basically shows the version of the file you’re browsing after the preprocessor has expanded all macros.

I know it’s a feature from Xcode 4, but since I didn’t see it before, perhaps some of you haven’t either.

Now, why is this useful?

didactic: several times I tried explaining to junior developers how the compiler works and how the preprocessor replaces all macros with their actual value, often being represented by some other macros. Best example is #import and #include directives. I think this tool makes it perfectly clear how does this process work and especially shows the output that without this, you can just picture.

track compiler issues: if you have a duplicate symbol compiler problem, your macros aren’t working the way you expected them, using the preprocess assistant takes you closer to the actual issue.

optimise build time and generated code size: if you want to see how your files actually look like and reduce them (which also reduces the build time), this assistant can be of great help. My 1st impression after using it was: I need to re-think and clean my pch files 🙂

Alternative: Product | Perform Action | Preprocess “YourClassName.m”

My old days of CodeWarrior development make me think about what great job has Apple done with their dev tools.

xcode_preprocess_assistant

Advertisements

4 thoughts on “Xcode preprocess assistant

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s