Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

    It also seems that whenever I have to write in C, I end up writing code that painfully wants to be object-oriented, or implementing features that are already part of C++.
So I guess you just don't really know/aren't comfortable with C. That's fine, but that hardly means that everyone else has the same problem.

    So why would you willfully pick to use C when C++ is around?
Because they are two very different languages and have their own strengths and weaknesses?

OO is not the "one true way", that has been shown time and time again. It's really not difficult to find a library for things you need in C. The fact that they aren't all available to include the moment you open your editor/IDE isn't a reason to use C++.

I use both C and C++ regularly. I love a lot of things about C++, but it also brings a lot of baggage along with it. It is an extremely complex language and I have seen some really, terribly awful code written in it.

I've seen bad C code as well, but C++ makes it easier to write bad code and harder to restructure it if you need to because you have to deal with much more abstraction. C++ also lends itself to writing code which contains very subtle errors in it. C makes that more difficult.

I read your post and I just hear someone with little C experience who loves his objects and can't fathom doing things another way.



> OO is not the "one true way"

Personally, I think C++'s big win over C++ is not OOP but generics. You can do OOP in C if you want; you can't do generics efficiently and safely.


You can't do generics in very much generality without compromising safety, true. You can get some (sometimes a surprising amount) done with macros, and safer now with static casts. Templates are still a win though, to be sure (syntax aside...)


Agreed, love templates.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: