Why is C++ preferred over C for commercial applications? [closed]

I program in C mostly. However, it is pretty obvious that many more commercial applications are done in C++.

As far as I can tell, C++ is a very complex language, with seemingly convoluted syntax and too many constructs. C++ also encourages the abuse of Objects where structs and functions will do. In fact, the only significant advantage I see in C++ is the use of templated generic types (though, according to the developers of Go, generics are bad for programs).

Basically, my question is, did I miss something? Or is C++ more popular purely by merit of luck or marketing?

Edit: I’m sorry that I apparently asked a loaded question; in retrospect I can see that the way I worded it appears to be complete flamebait.

What I meant was, since C++ has so many different constructs and paradigms available to it, why hasn’t it been replaced by languages that do less but are better at that specific thing? For instance, both Java and C# are much better suited for OOP than C++ is, while C is much simpler for system-level programming, and something like lisp is more suited for functional programming. Why is C++ used over one or more of these other languages?

8

Basically, my question is, did I miss something?

I believe you did, but it has less to do with programming languages and more to do with the human tendency to denigrate the unfamiliar. We do that. It’s natural. Rising above it takes a willingness to endure the cognitive dissonance that comes with the comparisons to the familiar when learning something new.

You’re doing two things you shouldn’t:

First, you’re looking at one language through the lens of another. One of the things you’ll start to understand as your horizons become broader is that programming languages are just toolboxes with variations on the same set of familiar tools. The variations exist to solve specific problems. Some toolboxes contain basic tools that force you to do a lot of things yourself; others give you things to make certain complex tasks easier. My wife, who makes jewelry, has a dozen pairs of pliers that have very unusual jaws designed to solve specific problems. To me they’re just funny-looking because her problems aren’t mine.

Second, you’re looking at every tool that’s not already in your toolbox as something ripe for abuse because it doesn’t fit your concept of “how it is.” I have news for you: anyone with a lot of experience in a language can find a way to abuse any of its constructs. C — and don’t get me wrong here, because I’ve written a ton of it — is especially rife with opportunities for abuse. Writing C is like owning a chainsaw: it’s a great tool for removing unwanted limbs, but the line between use and abuse lies in whether those limbs are attached to your trees or your neighbors. Constructs that enforce better behavior are the equivalent of adding blade guards and chain brakes to chain saws: they were put there by the more-disciplined to keep them from having to clean up the messy results of the less-disciplined abusing their tools and hurting themselves or others. A little light bulb will go on above your head the first time you realize you can do a complete reimplementation of a class without having to wonder if any other code is getting away with directly writing structure fields instead of calling the setter function you so thoughtfully provided.

Or is C++ more popular purely by merit of luck or marketing?

None of the above. C++ is in wide use for the same reason as any other popular language: people have found it a useful tool for getting things done.

12

People want to use OOP. Also programmers want to learn as few new things as possible. Thus, when C++ first came out. It gained massive popularity thanks to backwards compatibility with C and because it implemented OOP, which was gaining massive popularity at the time. This popularity created so much momentum, that it maintains lots of it right until todays.

[opinion]

But todays, many better OOP languages exist and there is much less emphasis on backward C compatibility. I would reccommend looking into Java, C#, Python or Ruby for modern OOP language.

[/opinion]

10

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật