Preprocessor for C/C++ gives full code details

CPIP preprocessor, implemented in Python, aims to provide developers with a wealth of information about their code

C++ Java PHP .Net Python JavaScript code type input keyboard

The Python-based CPIP preprocessor for C/C++, having just reached a de facto 1.0 release milestone and available for download, aims to provide developers with a wealth of information about their code.

Rather than regard preprocessing as a "dirty job" to be done quickly, CPIP records all details of preprocessing for inspection, the project's Web page says. "The aim is to provide rich information for developers about their own code that was never available before," developer Paul Ross said in an email. Version 0.9.1 was released last week and is tantamount to a 1.0 release, being fully standards-compliant and able to build the Linux kernel.

CPIP is intended to expose everything that happens in it in a developer-friendly way, said Ross, who has worked as a senior software engineer at Google and developed CPIP during his morning commute. "CPIP is the only developer tool that allows you to understand things like what preprocessor macros are used where, what files are included in your code and why, and so on."

Python was the language used for CPIP because it was quick to develop in and is perfectly suited for test-driven development, Ross said. The run time may be slower than other languages, but CPIP is all about providing accurate, clear information rather than raw processing speed, he said.

An introduction to CPIP says few developers understand preprocessing, with many considering it an "obscure bit of black magic." But CPIP can produce visual information about file dependencies, macro usage, and so on.

"The preprocessor is an integral part of the C/C++ language and provides the first of the three essential stages that your C/C++ source code takes before becoming executable code -- the others are the compiler and the linker," Ross said.

He describes CPIP as being pretty mature right now. Any changes in the future will be about presenting preprocessor information in different ways for different developers.

"A long shot would be to integrate CPIP with Clang in some way so I'll have to go and look at that when I have time," Ross said

In a recent interview, C++ inventor Bjarne Stroustrup touted the language as still the choice for complex, speed-driven applications. Recently, C++ 14 was released, expanding on the C++ 11 version. Meanwhile, C is the most popular language on the monthly Tiobe Index, although C++ was slipping.

Copyright © 2014 IDG Communications, Inc.

How to choose a low-code development platform