[ale] Assembly & C

Benjamin Scherrey scherrey at proteus-tech.com
Thu Sep 25 00:08:05 EDT 2003


9/24/2003 6:35:07 AM, Geoffrey <esoteric at 3times25.net> wrote:
<synco's thoughtful comments snipped>
>I'm with you.  C++ reminds me of cobol. ;)  To get the real bang from 
>C++ it needs to take advantage of code reuse.  

	I take it you mean COBOL in a pejorative sense? Code reuse is only one (nearly always 
misunderstood, btw) of a very many number of advantages of C++ for application developers. I 
guess you meant to say "To get the real bang from C++'s code reusability your application needs to 
reuse code."?

>Small projects just don't 
>get as much bang for the buck.  If you can endure the pain, long term 
>gains can be had from project to project.

	I really wonder where people come up with these assertions. First of all, the sheer size 
and capabilities of the standard component library makes getting small projects going much easier 
than a pure C based system unless your app has no need for containers of data (such as queues, 
stacks, and the like), typesafe formatted I/O, computational and data manipulating algorithms, 
dynamic relationships between data or considerations for i18n issues. Of course, the nice thing 
about C++, as in C, is that you don't pay any overhead for features you don't want or need. I don't 
see any pain here and the gains are both immediate and long term.

>FYI, we were writing OO C long before C++ was in the real world.  It is 
>a better way to code in many cases.

	I hear this assertion quite often. Since the properties required to be considered Object 
Oriented are support for inheritence, polymorphism, and encapsulation - this assertion is almost 
always a gross exaggeration. However, you do indeed find object-based properties in many 
applications written in non-OO languages, albeit not enforced by the compiler (and therefore, the 
language - which was the point in my previous email that synco recognized). So, with those 
caveats, I can say the same about my earlier asm and forth programming and would ask you the 
obvious question - why not just stick with assembler rather than these complex languages like C? 
The correct answer will be just as relevant when applied to C vs. C++. 

	Getting back to your final claim - I think that is provably false. If you are writing OO code 
in C because you have determined that you need these OO features, then I challange you to come 
up with a single case where using C is a better "way" than C++ unless your requirements 
specifically prohibit C++ ABI platform dependencies. Indeed even that issue can very often be 
addressed by wrapping your public interfaces with extern "C" constructs.

	Of course C++ is far more than just an OO language. It can be used as a procedural 
language as a "better C", as a functional or hybrid functional/oo language through its use of 
parameterized types or a combination of all these - in the same framework, as needed, and where 
appropriate - entirely enforced by the compiler and, therefore, the language itself. And all of this 
would not be possible today if Stroustrup didn't "inherit" the simple but capable features of that 
great language C and take it to the next level. C still has its place and is no less useful today than it 
was originally. However, quite often that place is inside a C++ program.

	So next time you feel threatened by the popularity of a language you don't like, rather 
than berate something you don't understand, why not instead tout the benefits of your favorite 
language and give examples of when it is the best tool for the job. Of course, synco and I already 
did that in our two previous emails since we were actually trying to constructively answer the 
original poster's questions rather than obfuscate the issue and send the thread into a flamefest.

	regards,

		Ben Scherrey





More information about the Ale mailing list