Home > Main > C/C++ : Power at Your Fingertips

C/C++ : Power at Your Fingertips


2008 October 03 | 10:36 am

So, what's this C Plus Plus thing, anyway?

C++ is considered by many to be one of the premier object-oriented programming languages. C++ is also one of the few truly compiled languages (with the exception of Microsoft's C++.NET, obviously) still widely used in modern computing. True C++ requires no framework or runtime environment to execute, unlike interpreted languages like Java and the various .NET languages.

Advantage?

One very important advantage to using a fully-compiled language like C++ is speed of code execution. Because it is compiled directly into machine code, C++ is able to skip the intermediate steps that Java and the various .NET languages must make. This means that C++ code executes a few orders of magnitude faster than an interpreted language, which is important when the code must execute in a high-precision environment, such as, say, a nuclear power plant...

Drawbacks?

One drawback to using C++ is the requirement of a suitable compiler for the target chipset architecture. What that means is that the same executable will not run on both an x86 architecture (Intel Pentium or AMD Athlon) and a RISC architecture (IBM PowerPC or Sun SPARC).

Okay, that's nice. So, what's with all these weird files?

Take a look at any C/C++ project, and you're likely to see a plethora of files, some with a .cpp file type and some with a .h file type. Look further, and you'll see that, with some exceptions, each .cpp file has a matching .h file. Why is that?, you may ask? Well, the reason is fairly complex, and involves some terminology I'm not entirely up to snuff on, so let's keep it simple. For those just beginning to learn programming, it may help to think of it this way:

• The .h file is very similar to the Table of Contents you'll find in most books. It tells the compiler where everything is located, and what type of data will be involved.

• The .cpp file contains the actual code that will executed; namely, the functions that will act upon the variables within the program. Also, it is important to note that assignment operators (the equals sign) can only be used within the .cpp file, not the .h file.

C++ Keywords

asm auto bool break
case catch char class
const const_cast continue default
delete do double dynamic_cast
else enum explicit export
extern false float for
friend goto if inline
int long mutable namespace
new operator private protected
public register reinterpret_cast return
short signed sizeof static
static_cast struct switch template
this throw true try
typedef typeid typename union
unsigned using virtual void
volatile wchar_t while

Definitions:

A compiler converts the human-readable program code into machine code for the chipset to process.


Updated: 2008 October 17 | 11:13 am

Tags: C++, Code, Keywords

Back to top Comments ( 0 ) • Login to comment.

Sorry. There are currently no comments for this article.

Home > Main > C/C++ : Power at Your Fingertips