C/C++ (CeeCeePlusPlus) compared to RubyLanguage
Let's start with Ruby: what does Ruby do that C++ cannot do?
- Lets you write the same program in much less time.
- Lets you write the same thing in far fewer lines, which means fewer bugs and more understandability.
- Has built-in support for many things that require constant regurgitation of tedious idioms in C (e.g. iterating through a sequence)
- Lets you extend the language without resorting to using an error-prone text-substuting preprocessor
- Provides pleasure instead of the urge to tear your hair out.
- Eliminates a vast class of memory-related bugs
- Lets you test out code interactively in the interpreter
What does C or C++ do that Ruby cannot do? I would love to see counter-examples for any of the following. -- DevilsAdvocate
This list was a bit dated. Maybe all but the top four should be removed. --JesseMillikan
Both can do the same things--any program written in one can be written in the other, given enough time and effort. Please read TuringTarpit.
Ruby is most frequently used in scripting applications. It is a DynamicallyTyped language, and usually interpreted. Contrast with C++, which is StaticallyTyped and usually compiled to machine instructions.
- Write device drivers.
- Write embedded code.
- Write code AsFastAsCee
- Write shrink-wrapped consumer applications.
- Embed assembly.
- Encourage OpenSource collaboration (sucks, but true; OpenSource is a PopularityContest?).
- Write code portable to <insert obscure platform> (maybe ignorant; how portable is the Ruby engine?)
C/C++ compared to PythonLanguage
Python being the big winner of the ShortestWikiContest
C/C++ compared to DelphiLanguage
Delphi is an object-oriented extension to Pascal. It's pretty much supported by one particular vendor, and designed for business applications. Personally, I would only use Delphi for legacy stuff--meaning code which is written for an existing system implemented in Delphi. Nothing against the language per se, just that it isn't something freely available and portable to lots of different platforms
There are at least 2 open source implementations of Delphi, and besides that a freely downloadable GPL distribution from Borland for educational purposes.
One Open Source implementation (www.freepascal.org) runs on 5 architectures and 20+ OSes, and that count is still increasing monthly
Perl and Python are scripting languages. C and C++ are system languages.
They are different types of languages, for different applications.
C/C++ compared to VisualBasic
What does VisualBasic
do that C or C++ cannot do?
When I'm single-stepping through a program, looking at the source code in the debugger, I can (usually) change the code and continue stepping through the new code. With all the C development environments I know about, any change to the code requires a recompile before I can step through the new code. MSVC has supported Edit and Continue since version 6.0 for small changes (no type changes).
What does C or C++ do that VisualBasic
- I can embed assembly language in C and C++
- (device drivers cannot be written in VisualBasic).
- One has to go through the routine of declaring a Function every time one has to use an API in VisualBasic, unlike C++ where it is already declared in the .h file
- VisualBasic is available only on Windows
C/C++ compared to PostScript/ForthLanguage
What does PostScript
/Forth do that C or C++ cannot do?
- As soon as I type in a "function" in PostScript/Forth, it gets compiled and I can immediately execute that function from the command-line. C/C++ seems to require some sort of "test subroutine" and a much longer edit-compile-run cycle.
- Factor into smaller functions with less penalty.
- Extend the compiler and add new syntax within the language.
- Develop and debug device drivers interactively.
What does C or C++ do that PostScript
/Forth cannot do?
- There don't seem to be many good IDEs for Forth. Yet.
[Now hold on a doggone minute! Forth IS ITS OWN IDE! And an interactive one at that! Just because it doesn't have the "slick" look some are used to doesn't mean it's not extremely powerful -- it is. Forth is a programming language, a compiler, an editor, a methodology, an IDE, and a floor wax all in one package.
- Libraries are not very standardized or complete. The ANS Forth standard has very minimal library support compared to C and C++ standard libraries. (PostScript, of course, only has "libraries" to deal with print and graphics issues.)
[Its a semantic thing. In Forth, rather than "libraries," it has "vocabularies" and "wordlists." There are many of them, but one of the main tenets of Forth is to only code what you need, and libraries carry a lot of baggage with them. In Forth, adding and using a few well-chosen "words" may be all one really needs.
- It seems the main thing Forth does that C and C++ do not do is carry an ideology around with it. Related is the desire of Forth proponents to unask or redefine questions such that Forth is already the answer; if a problem doesn't quite fit on the Procrustean bed of what Forth excels at, parts of it get chopped off.
C/C++ compared to all other languages
What would you do in C/C++ that you wouldn't do in any other language? Interface with an OS that exposes a C/C++ API?
Ignoring for a moment the whole turing-complete line of argumentation, I can write device-drivers, DSP code, code for small embedded systems in a language that allows both close control over the generated machine code and use of high-level object oriented and generic programming constructs. Whew! --AndrewQueisser
[You know, preferences aside -- Forth can do all these things; in fact, it excels at each of them. One could even easily argue that Forth does these particular things better and more easily than C/C++.]
I would write robust, secure, and fast code with modern C++ idioms including specifically RAII. - SmugCppWeenie?
CategoryComparisons CategoryCee CategoryCpp