Live data from Hacker News

Why C Is Obsolete

softdevtube.com

21–30 of 75 posts

Re: Why C Is Obsolete

#21

Earlier quoted context omitted.

I think the point he was trying to make is that a good language allows a library to be a "domain specific embedded language", in which an expert in some domain who is not an expert in the host language can do meaningful work. The matrix example is a particularly flattering one for C++, since a good matrix library in C++ will provide syntax that is quite close to the notation that one would use on paper for matrices.

The matrix example is a particularly flattering one for C++, since a good matrix library in C++ will provide syntax that is quite close to the notation that one would use on paper for matrices. And it either (a) creates and destroys many intermediate structures or (b) templates everything by exposing the entire implementation to the user, resulting in slow compilation time and error messages that the domain expert co…

It's almost as if everything has tradeoffs, and engineers have to make them consciously!

Optimize when necessary. Until then, no need to mutilate expressiveness if the language allows it.

Re: Why C Is Obsolete

#22
C++ could have been so much . . . less.

Any language that takes the better part of a year to develop an adequate parser for is NOT to be trusted.

I had a long rant on RTTI, templates, the positively miserable experience around exceptions, and so on. But you've heard it before.

C++ should have /started/ with a string class and a set of collection classes, rather than having them be bolted on a decade later. This would have driven the language in much more useful directions.

I don't know if it's possible to remove features, but I've seen three groups independently come up with essentially the same C++ coding guidelines (the Google C++ guidelines are a great example), all deprecating large swaths of the language because they are dangerous, fragile or make bugs.

My experience with OS-level development is that you get a better code with vanilla C.

Re: Why C Is Obsolete

#23

Earlier quoted context omitted.

I think the point he was trying to make is that a good language allows a library to be a "domain specific embedded language", in which an expert in some domain who is not an expert in the host language can do meaningful work. The matrix example is a particularly flattering one for C++, since a good matrix library in C++ will provide syntax that is quite close to the notation that one would use on paper for matrices.

The matrix example is a particularly flattering one for C++, since a good matrix library in C++ will provide syntax that is quite close to the notation that one would use on paper for matrices. And it either (a) creates and destroys many intermediate structures or (b) templates everything by exposing the entire implementation to the user, resulting in slow compilation time and error messages that the domain expert co…

[deleted]

Re: Why C Is Obsolete

#24

Earlier quoted context omitted.

I think the point he was trying to make is that a good language allows a library to be a "domain specific embedded language", in which an expert in some domain who is not an expert in the host language can do meaningful work. The matrix example is a particularly flattering one for C++, since a good matrix library in C++ will provide syntax that is quite close to the notation that one would use on paper for matrices.

The matrix example is a particularly flattering one for C++, since a good matrix library in C++ will provide syntax that is quite close to the notation that one would use on paper for matrices. And it either (a) creates and destroys many intermediate structures or (b) templates everything by exposing the entire implementation to the user, resulting in slow compilation time and error messages that the domain expert co…

Yeah, I'm not a big fan of C++, really. That said, (a) is mostly solved in 11 with rvalue references, isn't it?

Re: Why C Is Obsolete

#25
post #7

I don't understand his matrix example. in C++, you'd have a Matrix class with a getter. To get an element of the matrix you'd do int v = pMatrix->get(i,j); whereas in C you'd typedef a Matrix structure type and have an accessor function int v = matrix_get(pMatrix,i,j); Looking inside the functions, they'do pretty much the same thing. In both of these functions you'd be basically accessing either element i+imax * j of…

You can of course implement the same functionality using either C or C++. I agree - the two implementations would be very similar. But I don't think this is the point Bjarne is trying to make.

C++ challenges you to think in terms of types instead of functions. This is in my opinion often a more natural way to approach and solve problems and thus produces more elegant code. Because of that, C++ is a very powerful tool for library developers - you can design libraries that allow domain-specific developers to write expressive code that performs as if you had written more verbose C code. And this C++ code is not only more expressive for your fellow co-workers to read and understand but also in some cases for the compiler. This is the reason why C++ code can sometimes be compiled to faster machine code: you can give the compiler more information about what you actually try to accomplish (keyword: template meta-programming).

As with most things there is no definite answer. C code can be quite elegant and appropriate as well.

Re: Why C Is Obsolete

#26
post #9

> He explains that the languages should have been merged into one, so that C would have been a subset of C++ instead of nearly a subset of C++. Thank the stars this didn't & won't happen! Bjarne has been stuck in "C++ is the best & only language anyone needs" long after the world has moved on to Java, C#, Python, Ruby, JavaScript, etc. C occupies a sweet spot combination of: - low-level with "no magic" - small enough…

Then again, browsers are written in C++ and so are almost all GUI apps. We spend most of our time with software that is developed in C++, probably for a good reason

so are almost all GUI apps

This claim is clearly false on Mac OS X and X Window platforms, and disputable on Windows, with the increasing share of .NET apps.

Re: Why C Is Obsolete

#27
post #16

Earlier quoted context omitted.

> when the only "magic" was basic virtual functions What's "magic" about structs of function pointers? This is a classic idiom in C, just given a specialized syntax in C++.

With that argument you could invalidate any high-level language construct. They're all just "specialized syntax" of classic idioms in Assembly.

Exactly. And nobody thinks that for loops are "magic".

Re: Why C Is Obsolete

#28
I cannot access the article so I am only able to respond to the title at this time. I'm not a big fan of such sweeping generalizations. I am biased- I write in C all day long. C's basics are fairly easy to learn, it's an incredibly fast language and more than anything it is still in use! It may not be "elegant" nor mimic the style the author would prefer to write in but it certainly has a purpose and just because that purpose may not match his coding style that does not mean /everyone/ should jump ship and declare it as being "obsolete."

It is my basic belief there should be many tools in a developers toolbox and you should not always use the hammer on a screw or a very precise scalpel when trying to remove a sliver when a pair of tweezers will get the job done.

If you want to declare a language obsolete I recommend we discuss a language that is not in the top three!

Re: Why C Is Obsolete

#29

C++ is a kludge. There should ideally be only two types of languages. System level: C Web-App Level: Python/Javascript/Java

Everything but systems stuff should be a web app? I think some category of software is getting skipped here.

Re: Why C Is Obsolete

#30
post #9

> He explains that the languages should have been merged into one, so that C would have been a subset of C++ instead of nearly a subset of C++. Thank the stars this didn't & won't happen! Bjarne has been stuck in "C++ is the best & only language anyone needs" long after the world has moved on to Java, C#, Python, Ruby, JavaScript, etc. C occupies a sweet spot combination of: - low-level with "no magic" - small enough…

> long after the world has moved on to Java, C#, Python, Ruby, JavaScript, etc.

I don't think this is true for everyone. In fact I believe recently we have seen a renaissance of native code. C++ is the number one language for that. Those higher level languages waste a lot of cycles. You pay the warm and fuzzy feeling during development with performance and/or energy.

Post reply on HN