C++
Path Computers    Programming    C++
All tutorials in C++
Sort By:    Name   Rating   Views  Comments    Date 
Browse Pages :    1  2  3  4  >  >> 
Objects in C++
Submitted 13 June 2008

C++ does much more with initializing objects than C does. For example, class objects have constructors, and global objects can have general initializers that cannot be evaluated at compile time.

Views: 510 Comments: 0
General Initializers
Submitted 13 June 2008

When a program is loaded by the operating system for execution, a common scheme will have the text and data stored within the binary file on disk that represents the program, and the bss section simply stored as an entry in a symbol table and created and zeroed dynamically when the program is loaded.

Views: 391 Comments: 0
External Linkage
Submitted 13 June 2008

One of the common issues that always comes up with programming languages is how to mix code written in one language with code written in another.

Views: 368 Comments: 0
Type Names In C++
Submitted 13 June 2008

Taking advantage of this feature, that is, giving a class type and a variable or function the same name, isn't very good usage. It's supported for compatibility reasons with old C code; C puts structure tags (names) into a separate namespace, but C++ does not. Terms like "struct compatibility hack" and "1.5 namespace rule" are sometimes used to describe this feature.

Views: 465 Comments: 0
Inline Functions
Submitted 13 June 2008

Such a function is written just like a regular C or C++ function. But it IS a function and not simply a macro; macros don't really obey the rules of C++ and therefore can introduce problems. Note also that one could use C++ templates to write this function, with the argument types generalized to any numerical type.

Views: 333 Comments: 0
Operator Overloading
Submitted 13 June 2008

Operator overloading in C++ is very powerful but can be abused. It's quite possible to create a system of operators such that it is difficult to know what is going on with a particular piece of code.

Views: 415 Comments: 0
Function Overloading
Submitted 13 June 2008

Suppose that you are writing some software to manipulate calendar dates, and you wish to allow a user of the software to specify dates in one of two forms:

Views: 315 Comments: 0
Declaration Statements
Submitted 13 June 2008

In C++, declarations of this type are not required to appear only at the top of the function or block. They can appear wherever C++ statements are allowed.

Views: 426 Comments: 0
Operator New/Delete
Submitted 13 June 2008

This term doesn't have a precise meaning, but one way of looking at it is to focus on the features C++ adds to C, exclusive of the most obvious one, namely the class concept used in object-oriented programming.

Views: 304 Comments: 0
References in C++
Submitted 13 June 2008

In another tutorial we discussed using function prototypes in C++ to eliminate a common type of error encountered in C, that of calling a function with the wrong number or types of arguments. Another C++ feature that can be used to reduce programming errors is known as references.

Views: 278 Comments: 0
Duplicate Inlines
Submitted 13 June 2008

So what happens if the inline function is not expanded as inline? The answer varies from compiler to compiler. The traditional approach is to lay down a static copy of the function body, one copy for each translation unit where the inline function is used, and with such copies persisting throughout the linking phase and showing up in the executable image. Other approaches lay down a provisional...

Views: 265 Comments: 0
Per-class New/Delete
Submitted 13 June 2008

Some types of applications tend to use many small blocks of space for allocating nodes for particular types of data structures, small strings, and so on. In issue #002 we talked about a technique for efficiently allocating many small strings.

Views: 284 Comments: 0
Stream I/O Performance
Submitted 13 June 2008

Is stream I/O slower than C-style standard I/O? This question is a bit hard to answer. For a simple case like:

Views: 369 Comments: 0
Function Prototypes
Submitted 13 June 2008

People often ask about how to get started with C++ or move a project or development team to the language. There are many answers to this question. One of the simplest and best is to begin using C++ as a "better C". This term doesn't have a precise meaning but can be illustrated via a series of examples. We will cover some of these examples in forthcoming issues of the newsletter.

Views: 265 Comments: 0
Declaration Statements
Submitted 13 June 2008

This approach does an expensive computation each time, even under error conditions. A way to avoid this would be to say:

Views: 276 Comments: 0
Browse Pages :    1  2  3  4  >  >>