LWN.net Logo

C vs. C++ vs. ...

C vs. C++ vs. ...

Posted Jul 1, 2012 19:16 UTC (Sun) by HelloWorld (guest, #56129)
In reply to: C vs. C++ vs. ... by khim
Parent article: Why learn C? (O'Reilly Radar)

> From C++ to C, of course.
Well, you wrote that you converted the code from C to C++.

> Not really. The difference is subtler. C++ code uses nice, buzzword-compliant "flexible" architecture (similar to the style showed here). C code uses (as I've said) large functions and macroses. Instead of 10 layers of indirect functions is has dozen of flags (which are processed by said macroses).
>
> This means that it's impossible to do many things with C module which were possible with C++ module - and this is good thing. Because it means that instead of abusing callbacks to do something strange and exciting people need to change the core - which then means that code will be reviewed by people who know how said core works. Which in turn means that fewer stupid things will be introduced in the system.
Oh, so C is better than C++ because it forces you to program in a certain way that happened to be the right way for your specific case? Sorry, but that doesn't really make sense. What is right for your project may not be right in other circumstances. I prefer a tool that lets me chose the most sensible approach instead of forcing its approach down my throat.


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds