Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: I'm glad I know a little perl...

by tkil (Monk)
on May 31, 2004 at 02:01 UTC ( [id://357716]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: I'm glad I know a little perl...
in thread I'm glad I know a little perl...

So, why do you hate C++ and prefer C?

Personally, I much prefer C++ over C. But I have a few theories as to why others might prefer C:

  • It's a smaller, simpler language. K&R 2nd ed. is a slim volume, about 150 pages or so. Stroustrup "Special Edition" is somewhere north of 1000 pages.
  • When I transitioned from C to C++, I found myself spending 90% of my time working on header files. While my overall time to a functional solution went down, it did sometimes feel like I wasn't coding as much as I used to under C. In C, it is easier to just start coding, as it does not force you to think about larger-picture issues as often — or, at least, as early — as C++ does.
  • C is "closer to the metal". People can mentally map a given chunk of C code to assembler (or at least they think they can; modern compilers and CPUs are liable to do much stranger things to the code than the average programmer).
  • The (mostly mythical) issues of efficiency. Using C++ in all its power does inflict overhead, both space and time, at compile time, link time, and runtime. Whether this overhead is noticable, and whether it is recovered by the progress of technology in the amount of time you save by using higher-level languages, is less certain.
  • Earlier versions of C++ (both the accepted language definitions and the compilers that supported it those to varying degrees) had issues and shortcomings that could turn people off in a hurry (remember generic.h?). Also, some widely-used frameworks did their best in those limited languages, with painful results (hello MFC). If coders have not dealt with a modern compiler and modern library, they might still be thinking of 1994 C++.
  • C++ with proper use of the STL can often leave coders feeling that they are just monkeys connecting components together and never writing anything fun or interesting.
  • As you mention, there are a lot of C libraries that try to do OO-ish things, and those models often fail to interact gracefully with the C++ object model. this can cause people to avoid C++ entirely.
  • Some of the features of C++ make it difficult to interact gracefully with any libraries (templates, exception handling, RTTI, virtual functions).

As I said above, I personally prefer C++ over C for almost every task where I am forced to use a low-level language. The above are some of the reasons I've heard others give as to why they don't care much for C++, though.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://357716]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-19 22:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found