Live data from Hacker News

For C programmers that hate C++ (2011)

thanassis.space

1–10 of 18 posts

Re: For C programmers that hate C++ (2011)

#3
The problem with C++ is not the features that help you write better, safer code as explained here. The problem is that C++ has so much bad and people do use it. C++ is good as long as it's a solo project, it's okay for small projects, it inevitably fails on large projects.

Re: For C programmers that hate C++ (2011)

#4
post #3

The problem with C++ is not the features that help you write better, safer code as explained here. The problem is that C++ has so much bad and people do use it. C++ is good as long as it's a solo project, it's okay for small projects, it inevitably fails on large projects.

> it inevitably fails on large projects.

This is not even REMOTELY true. Plenty of companies use massive pure C++ projects.

Re: For C programmers that hate C++ (2011)

#5
C has gotten a lot better through standardization and tooling, it really is vastly improved compared to the flawed experience that K&R describes.

I can't say the same about C++, which feels as if one has to set clear and definite limits, banning most of the language, before one can deploy it in a sane manner.

Re: For C programmers that hate C++ (2011)

#6
post #3

The problem with C++ is not the features that help you write better, safer code as explained here. The problem is that C++ has so much bad and people do use it. C++ is good as long as it's a solo project, it's okay for small projects, it inevitably fails on large projects.

Code review and coding standards are needed for any project in any language. If people try to write unreadable C++, just don’t allow it.

Re: For C programmers that hate C++ (2011)

#7
C++ has so much language bloat I avoid it for that reason alone as working with other people's C++ code is such a pain (most of the time, not always). C is more verbose in some ways but doesn't suffer all that much from bloat, which makes it more appealing, to me anyway.

Re: For C programmers that hate C++ (2011)

#9
In embedded systems, space can be a premium (e.g. a recent project has 75MB for a rootfs). With C++, need to link to libstdc++ and libc, with C only need libc.

I find a number of developers reach for C++ because they aren’t comfortable with C or low-level development. For instance, will copy memory into a std::vector or std::string just to use the STLs search functions where a simple finite state machine would be more appropriate. I also find a correlation between C developers having a better understanding of things like file descriptors, poll/select/epoll for an event loop, while a C++ developer is more likely to use std::thread and then have to deal with proper locking.

Working in a constrained environment, I like C exactly because it “does less”. It’s more explicit, simpler, hides less behind abstractions in practice.

Re: For C programmers that hate C++ (2011)

#10
The right way to do this in C would be to define each type of pixel in its own file, along with processing functions, and use function pointers within the structs for required processing.

C++ classes are really just syntactic sugar for data organization. You can do the same type of organization in C, things just have to be more explicit. The benefit if using C is that you can use constructs where needed while trimming fat where its not.

Post reply on HN