Earlier quoted context omitted.
The later C standards add additional features. However, I'd argue that there is no such thing as a "great feature" in C++: almost everything in the language is a mistake, either intrinsically or in combination with other 'feature's. It's a blind pig with fifteen legs, trying to put on its own lipstick while riding a unicycle.
Spoken like someone who truly doesn't understand C. You even managed to confuse it with C++ (you might as well have said "Java" in the place of C++, it's about as close to C as C++ is) Well done. edit: Ignore this post. I misread. I'm an idiot. Sorry about that
How can C Programs be so Reliable?
41–50 of 105 posts
Re: How can C Programs be so Reliable?
#42Earlier quoted context omitted.
> Despite being the most popular form of employment for "programmers" it has always been the absolutely lowest form of life in a software ecosystem It just runs our banks, hospitals, governments... Much better to solely focus on those that write kernels, device drivers and filesystems?
So? Despite being useful, what's so interesting about CRUD programming for the enterprise? I've been there, I've had my share of dealing with coworkers that openly admit that they haven't touched a single book since graduation 10 years ago and they see no reason why would they want to. That's the kind of programmers this industry attracts, and that's the kind of software it builds. What's so interesting about it? Why…
To be honest, I'm still not sure what point you're trying to make is. At best it's somewhat of an Ad Hominem attack.
Re: How can C Programs be so Reliable?
#43The author misses the main point of exceptions: they let us separate data processing code from error handling code. This is why we are more productive in languages that have exceptions and our code is easier to maintain.
C requires us to handle errors throughout our program, tightly coupling the data processing code with the error handling code. With apologies to Mr. Spencer, I would declare that:
"Those who don't code in languages that lack exceptions are doomed to reimplement them, poorly."
Re: How can C Programs be so Reliable?
#44Earlier quoted context omitted.
But oftentimes I want a correct result or an obvious failure, without having to handle tons of errors I don't even want to account for.
Returning -1 is an obvious failure. What you're saying is that you want your programs to blow up when a function returns a known error (such as "disk full"). One of the points of the article is that C makes you think about all the possible, well-documented, errors that each function can encounter. You know when you write C precisely what can go wrong at each stage, and decide the right way to handle it. Seeing a dial…
I think the space between to two is more uncomfortable than either extreme.
Re: How can C Programs be so Reliable?
#45Earlier quoted context omitted.
Spoken like someone who truly doesn't understand C. You even managed to confuse it with C++ (you might as well have said "Java" in the place of C++, it's about as close to C as C++ is) Well done. edit: Ignore this post. I misread. I'm an idiot. Sorry about that
I think you misread the comment you were responding to, and the comment that it was responding to.
Re: How can C Programs be so Reliable?
#46Earlier quoted context omitted.
The only time a function would "silently" return a -1 would be if you're not checking your returns for errors! Functions have return codes for a reason .
But oftentimes I want a correct result or an obvious failure, without having to handle tons of errors I don't even want to account for.
Re: How can C Programs be so Reliable?
#47Earlier quoted context omitted.
So? Despite being useful, what's so interesting about CRUD programming for the enterprise? I've been there, I've had my share of dealing with coworkers that openly admit that they haven't touched a single book since graduation 10 years ago and they see no reason why would they want to. That's the kind of programmers this industry attracts, and that's the kind of software it builds. What's so interesting about it? Why…
I think how interesting it is depends on your interest. If you are heavily into programming, as it seems you are, I can understand that SQL queries seem trivial and boring. If your interest is elsewhere programming is often just a tool used to create the interesting stuff. Whether that is usability, design, getting people to interact in new ways, launching rockets or automatically turning off your garden lights when…
Re: How can C Programs be so Reliable?
#48Earlier quoted context omitted.
if ((result = foo()) == -1) { fprintf(stderr, "!$*!$&^!$*!!!!\n"); exit(1); }
If exit() is too abrupt, you can always use setjmp() and longjmp() to set up a non-local jump to an error handler.
Re: How can C Programs be so Reliable?
#49Earlier quoted context omitted.
I use Linux, but I am still surprised it is really stable. At low level it's quite messed up and shows the cons of being a pseudo-bazaar ecosystem. Lately it's changing to a cathedral with a handful of core developers acting quite dictatorial and perhaps that will clean up things a bit. I'm not advocating any of both camps, just bringing up it is far from perfect. In particular I've spent last week trying to figure o…
In contrast, I consider the Linux kernel code clear and clean. I have mostly looked through the scheduling and file system code; I can't speak for TCP/IP port management.
Re: How can C Programs be so Reliable?
#50Earlier quoted context omitted.
that was my experience when I went from ASM - to functional and then C when wrangling hardware. I am still surprised at how reliable C apps can be (linux kernel) - hats off to the genii involved in making things stable.
I use Linux, but I am still surprised it is really stable. At low level it's quite messed up and shows the cons of being a pseudo-bazaar ecosystem. Lately it's changing to a cathedral with a handful of core developers acting quite dictatorial and perhaps that will clean up things a bit. I'm not advocating any of both camps, just bringing up it is far from perfect. In particular I've spent last week trying to figure o…