Stuart wrote in reply to James Kuyper:
[snip]
I'm intrigued. I have never ever met someone who described himself [James
Kuyper, whom I replied to at that time, not William Ahern] as a C
programmer. May I ask what kind of business you are in? My guess is your
line of work includes either device drivers, embedded devices, kernel code
or something else that forces you to write C instead of C++. In all these
years I have never met someone who used C instead of C++ unless he was
forced to do so.
Well, you have now. I've worked in several shops (both small and billion
dollar companies) which were C only by choice. The consensus was that the
cost/benefit of C++ didn't pan out, particularly for backend, non-GUI work.
When you're writing high availability server software, the fewer moving
parts the better.
C++ can be too big. You can certainly cherry pick features, but different
people cherry pick different features. And you also need someone who
understands _all_ the features to go through and grok those used and unused.
In all the shops I have worked so far this choice was always up to me.
To put it more correctly, whenever I felt that the established
programming techniques became insufficient due to the restricted set of
compiler features, I made a presentation that showed how much effort a
particaluar, hitherto unused compiler feature can save. And if you use
the right words, your boss can almost never disagree with you because
any new technique that saves anything must be good! ;-)
Plus, there's linking, interoperability, etc, which is more of a pain. And
C++'s strict typing can lead to code bloat and/or excessive casting.
There are lots of cool features in C++, but often those features are better
implemented in other languages.
Do you mind giving an example? I often find that I have the wish to use
another programming language because it has some library that does not
exist under C++ (I haven't found platform independent C++ GUI library
that satisfies my needs, for example), but that should not be an
argument against the programming language itself because one just had to
implement a similar library for C++. There should be nothing inherent to
GUI programming that makes this problem space incompatible with the C++
programming language, I think, although the qt people think that
reflection is a good thing for GUI programming. But that is a story for
another day...
Scripting can also be a good argument against C++. Although there are
efforts to provide C++ scripting environments, this is probably too
difficult a task for the open-source community (and the industry does
not seem to be bothered with such a thing). I have only ever seen BGB
who designed a language called BGBScript that resembles C and can be
either compiled and interpreted, but chances are little that his
language will become main-stream.
It can be easier to use C + [insert other
language], then just C++. So, depending on your perspective, C++'s winning
features can seem middling to someone willing to use more than a single
language.
Interesting point. However, I always considered the additional friction
that stems from making two programming languages interoperate too much
an effort, so I decided to stick to a programming language that can to
"everything". Maybe that is a wrong thing to do (the last company I
worked at decided to use C++ for the hardware communication layer and C#
for the GUI, but that never really took off).
I'm guessing that you come from a Windows background and/or graduated
college in the past 3 or 4 years. That's usually how it goes, IME. C++
didn't make waves in the Unix world until a few years ago,
That always struck me as odd. After all, C++ was not invented by some
large company that wants to dictate what people should want (as it feels
when I use C# or Java) but by a single guy whom you can chat with in a
newsgroup. Almost grassroots, as one could say.
and then it took
off with Google and Apple**, especially when they picked up their college
recruitment. C++ grew up in Microsoft-land and in Microsoft-friendly
universities which dumped SUN--or never had the history to begin with. Which
isn't a slight, just an observation about the peculiarities of C++ culture.
Windows background, true, but not due to university. My hometown
university only offers a undergraduate course that is more or less a
introductory course for languages like Ada, C++ and Java. So one should
not be surprised to meet postdocs in computer science that don
I started to code in C++ ten years ago when I worked during semester
break at Fraunhofer institute. They used Borland's C++ compiler (*
sniff, remembering the good old times *). I had a look at some book that
showed how to write Win32 GUI apps with C and I found it awful. All
those gigantic switch statements, brrr ...
Admittedly, there may be some wrapper libraries for Win32 API that were
written in C, but I couldn't find a suitable one. Apparently C
programmers were supposed to use the Win32 API directly, I guess.
Regards,
Stuart