Skip to content

Comment on CPIP – A C/C++ preprocessor implemented in Pythonparent

Comments

C++ has more powerful tools than preprocessor and is used in different scenarios. On the other hand, C is predominant language in embedded systems (while C++ is available it is usually highly stripped version), where performance and memory (both binary and runtime) footprint is critical. Therefore code elimination/swap for different hardware and/or slightly different featureset is best done at compile time using preprocessor. And we need best tools available to debug that.

it is usually highly stripped version

Wouldn't this be the main reason C is predominant, combined with historical reasons a la 'predecessor used C as well'? I find it hard to believe one wouldn't be able C++ which is as efficient as C. Afaik the preprocessor features are exactly the same. Also I've seen the virual function overhead card being played too much and it doesn't make too much sense: one can benefit from goodies like templates/lambdas/STL without using virtual inheritance. And all those goodies mostly appear when writing the code, i.e. make for faster cleaner development: after the compiler went over it they are all optimized away and turned into what looks a whole lot like assembly generated from plain C.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.