Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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

by BUU (Prior)
on May 30, 2004 at 10:40 UTC ( [id://357584]=note: print w/replies, xml ) Need Help??


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

Since we're wandering in to the topic of language debate, personally I can't stand C, I much prefer C++, probably because I'm bitter over using lots of C code that tries to be OO, but with none of the OO features that make OO practical. *mutter.

I see this sentiment a lot though (people hating C++ but liking C), and I still don't understand why. I tried asking why in another node some what similar to this one and got some of my diferences between the two (c and C++) nit picked, but I never really got what I felt was a substantiative answer.

So, why do you hate C++ and prefer C?
  • Comment on Re: Re: I'm glad I know a little perl...

Replies are listed 'Best First'.
Re^3: I'm glad I know a little perl...
by tkil (Monk) on May 31, 2004 at 02:01 UTC
    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.

Re: Re: Re: I'm glad I know a little perl...
by McMahon (Chaplain) on Jun 01, 2004 at 15:23 UTC
    I knew a C programmer once who liked pure C simply because there's no magic. The programmer is in direct control of every aspect of the program.

    I've never written any C, but I used to debug a fair amount of it, and I really appreciated this programmer's code. It was really tight, easy to read (for C), and rarely contained surprisess.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-25 05:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found