Live data from Hacker News

Why C Is Obsolete

softdevtube.com

41–50 of 75 posts

Re: Why C Is Obsolete

#41
post #32

Earlier quoted context omitted.

If you now wanted to have polymorphism, you'd have to do even more work in the function, which would probably involve looking up a function pointer in a table and invoking that (i.e. Linux VFS). If you didn't start out wanting polymorphism, but then wanted to add it, C++ is way less work to do it. Why code this all by hand when the language can do it for you at no penalty? The only penalty I see in C++ for using clas…

> Why code this all by hand when the language can do it for you at no penalty? The only penalty I see in C++ for using classes or polymorphism is that it produces longer symbol names (w/ the type mangling) There are other penalties which people who write C++ are oblivious to. For example, switching the class of an established object in runtime: Suppose you have two compatible class layouts (same field order and types…

>In my experience, the overall effect of C++ on a project is negative. YMMV.

Curious: What's your domain?

In video games where there are a lot of "objects" floating around that can really benefit from polymorphism, the type checking that C++ can do that C can't really gives you a huge development bonus.

Of course I'm saying this having moved past C++ for 99% of the development into an elegant and tiny scripting language called Lua, where you can do just about anything (including having an object system that you can change an object from one type to another trivially if that's what you want).

Re: Why C Is Obsolete

#42
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.

I used this argument for Java, but it's the same with C++.

If I can deliver a first version 2 months before the C++ version gets ready, I'll have two months to optimize market-tested algorithms before you hit the market. I may even have time to rewrite the sensitive parts in C.

If we are talking gadgets with embedded software, you may use a less powerful hardware and offer a cheaper product, but you'll have to amortize higher development costs and deal with a longer time to market.

For many things the world really moved on. C and C++ are still important, just not as important as they were a decade or two ago.

Re: Why C Is Obsolete

#43
post #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…

Every person uses a different subset of C++, but that subset varies from a group to the other. You cannot therefore "remove features from C++". A lot of people use C++ to code as they would in Java or C#, generally their experience is terrible. Exceptions don't work the way you think they do (in C++ exceptions should be exceptional). Polymorphism is more verbose, it's not introspective, etc. There's much to say about…

"""Every person uses a different subset of C++, but that subset varies from a group to the other. You cannot therefore "remove features of C++""""

Actually you can. You don't remove them from the existing language that is, you make a better language with bs/redundant removed.

While "every person uses a different subset of C++" is true, it's not like everything someone uses is equally beneficial to have in a language. As the parent said, what is useful and what is not is not that controversial:

"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"

Re: Why C Is Obsolete

#45
The problem is C is "good enough" and C++ is "complex".

The only serious alternative system programming languages have been offered up by Niklaus Wirth and associates. Not much traction among developers...

Re: Why C Is Obsolete

#47
post #32

Earlier quoted context omitted.

> Why code this all by hand when the language can do it for you at no penalty? The only penalty I see in C++ for using classes or polymorphism is that it produces longer symbol names (w/ the type mangling) There are other penalties which people who write C++ are oblivious to. For example, switching the class of an established object in runtime: Suppose you have two compatible class layouts (same field order and types…

>In my experience, the overall effect of C++ on a project is negative. YMMV. Curious: What's your domain? In video games where there are a lot of "objects" floating around that can really benefit from polymorphism, the type checking that C++ can do that C can't really gives you a huge development bonus. Of course I'm saying this having moved past C++ for 99% of the development into an elegant and tiny scripting langu…

Hmm, a friend of mine from Criterion said that in two of the last games they did, they had to re-write the Lua parts (fairly significant) in C++ to get the framerate high enough as it's memory fragmentation was just too much.

They went from ~34 fps to ~60 fps for 4 developer weeks re-writing the Lua code.

Re: Why C Is Obsolete

#48
can't access the article for some reason, but i'm not sure if i agree with the title--there are still a shedload of fairly significant applications and software written in c (not c++): linux kernel, nginx, apache, etc.

c is still one of the most efficient languages out there next to assembly languages, you have complete control over memory management, most of the compilers produce highly optimized native code across multiple platforms, and there are a wealth of system level libraries to do some really significant things, i.e. it's as close as you can get to bare metal without having to deal with machine code.

i want to be clear here because i have been on both sides of the fence writing enterprise software in c as well as more recently in java, python, ruby, etc, so i know the advantages (and disadvantages) of OO versus a procedural language like c which i'm guessing is the major argument of the article. having libraries and frameworks like ruby on rails will significantly increase productivity and time for development, which in itself is a major win, but when you're talking about maximum performance, c is probably your best choice.

in general i think that writing software in the 21st century is still too complicated and error prone. if i want to write a web app, why do i still need to parse strings, perform database queries and such? why can't i have higher level abstractions or frameworks/libraries that give me this functionality. that's why i like django and rails, they seem to be moving in that direction (convention over configuration), though at the end of the day, you're still working with strings, arrays, and such. we should have software systems that provide even higher level abstractions than components and frameworks, for example, i want to create a social networking website that stores billions of 140 byte character messages, these messages should be searchable, this needs to run on iphone, chrome browser for windows, linux, etc. it would be great if the focus was on the features described like above and functionality rather than having to deal with SQL, arrays, strings, templates, css, ajax, etc. maybe the closest thing to this is like packaged software where everything is pretty standard and you customize only the portions that are necessary (maybe like twiki). i should never have to deal with SQL or even ActiveRecord (even though it's a nicer abstraction over SQL), all this logic should be taken care of for me, i should only have to define the high level stuff. when we get to that point, that's when i believe that we'll have achieved 6GL.

7GL would be where the software would have enough intelligence to figure out that it needs what features and have those implemented automatically.

Re: Why C Is Obsolete

#49
post #26

Earlier quoted context omitted.

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.

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

Actually it is not.

On OS X tons of programs, and especially the very largest, most popular ones, are in C++ (think: Photoshop and the Creative Suite, MS Office, and lots of Apple's own: Safari (webkit) is C++, Final Cut and Logic are C++, etc. Don't confuse the front-end UI code (Cocoa) with the backend. C++ is a first class language in XCode, and you can mix it with Obj-C as Objective-C++.

On X Window platforms: besides KDE, some of the most important apps are C++, including Firefox, Thunderbird and Open Office.

On Windows there are almost no .NET apps that people actually use --people as end users, as opposed to corporations. Most of the popular stuff, from games, to office suites, to design suites, to browsers, etc are C++.

Re: Why C Is Obsolete

#50
I hate this superset/subset idea -- those are just different languages, with separate philosophies and totally incompatible practice sets. Merging is an equal madness as merging Haskell with Python.

On the other hand, from a fully practical view, even after omitting all incompatibilities a C code compiled with C++ compiler will be bloated with C++ standard lib, and will have screwed symbols.

Post reply on HN