Hello, and welcome to DDJ.com
CMP Media Launches New Dr. Dobb's Journal

SD West 2006 announces this year's list of Jolt Product Excellence Award winners and Productivity Award winners.

LOG INRegisterForgot password?
What are the green links?
All Access members only
RSS Feed
DDJ > Dr. Dobb's Departments > C++

C++

Editor's Note | News | Features | Products | Discussion Forum | C++ RSS Feed

Power tools, techniques, state-of-the-art and standards for core OO application and systems development.


Source Code Integration
Jonathan Erickson
Alex Krapf discusses the challenges developers face when integrating source code from different programming languages such as Java and C++. (MP3, 5:40 mins.)

Accelerating Compute Intensive Functions Using C
Joe Hanson
Joe examines how you accelerate application processing using a software-configurable architecture to achieve hardware-accelerated performance in C.

Managed C++ and the Side-by-Side Cache
Richard Grimes
The Visual Studio installer places Visual Studio shared libraries in a location called the "side-by-side cache." Here's what you need to know to leverage it.

Overloading and Overloading
Pete Becker
Operator overloading may be syntactic sugar, but there are a lot of things that don't taste very good without sugar.

Keeping C/C++ Code Scalable
Kirk J. Krauss
Kirk presents techniques for identifying committed virtual address space in C/C++ programs.

STL and TR1: Part III
Pete Becker
With TR1, C++ gets hash tables in the form of the template classes unordered_map, unordered_multimap, unordered_set, and unordered_multiset.

Invariants as an Intellectual Tool
Barbara E. Moo, Andrew Koenig
Invariants are a great way to make sure your loops are doing what you expect.

Maps with Expensive Keys
Andrei Alexandrescu
STL containers are easy to extend, which is why Andrei was surprised when he happened upon a problem that cried out for an extension to std::map, but ultimately couldn't be solved that way.

C++/CLI Sockets
Rex Jaeschke
If you want interprocess or interapplication communication, you want to know how to use sockets. Rex shows us the way.

Multiple Inheritance Considered Useful
Jack W. Reeves
Arguments against multiple inheritance range from the philosophical to the practical, but in the end only one question matters: Is it useful?

Associative Chains in C++
Phillip Bruce
Phillip gets around some of the limitations of the pointer-to-member with a model of class associations that he calls "Associative Chains."

Syntactic Aspartame: Recreational Operator Overloading
Sander Stoks
Some say operator overloading is nothing more than syntactic sugar. Use it with proper caution, however, and you can reap real rewards.

A Frame-Based Message-Passing Parser for C
Robert Kiesling
Ctalk, an object-oriented preprocessor for ANSI C, contains a novel parser design that's well suited to interpreting object-oriented languages.

SSH Kerberos Authentication Using GSSAPI and SSPI
Glen Matthews
Kerberos authentication can be an effective safeguard against man-in-the-middle attacks. Glen implements Kerberos by way of two popular APIs.

Validating C and C++ for Safety and Security
Robert C. Seacord
Sometimes the only way to track down security flaws such as buffer overflows is to roll up your sleeves and manually review the code. Robert outlines a process for manual review that's based on Safe-Secure C/C++.

Flexible C++ #14: Finding Child Windows with Simulated Local Functions
Matthew Wilson
A common problem in Windows programming is retrieving a descendent windows by Id. This is the topic Matthew examines this month. Additionally, he uses the problem to illustrate how some languages can use local functions to maximize encapsulation.

Of Interest

February 2006 Of Interest.

Inside C# and .NET
Peter N. Roth
Peter reviews Stephen C. Perry's "Core C# and .NET."

Viewing & Organizing Log Files
Phil Grenetz
LogChipper, the tool Phil presents here, lets you view and organize the contents of log files.

Google's Summer of Code: Part III
DDJ Staff
Google's Summer of Code resulted in thousands of lines of code. Here are more students who participated.

Sudoku & Graph Theory
Eytan Suchard, Raviv Yatom, Eitan Shapir
Understanding graph theory is central to building your own Sudoku solver.

Native Queries for Persistent Objects
William R. Cook, Carl Rosenberger
Among other benefits, native queries overcome the shortcomings of string-based APIs.

Examining uC++
Peter A. Buhr, Richard C. Bilson
uC++ was designed to provide high-level concurrency for C++.

New Products

January 2006 New Products.

Building More Flexible Types with Mixins
Christopher Diggins
The Curiously Recurring Template Pattern doesn't have to be exotic. Christopher uses it to make some flexible data types.

Hotter Events
John Torjo
Sometimes you need to define your own custom events. John shows how to make it as easy on yourself as possible.

A View to a String: Part I
Matthew Wilson
The D language includes the concept of the slice. Matthew shows how the "View" concept can help to model this in C++.

STL and TR1: Part II
Pete Becker
Pete continues his discussion on STL in TR1 with a peek at the new template class .

C++/CLI by Example: Serialization
Rex Jaeschke
Serialization allows objects to be stored externally--Rex shows us how it's done in the C++/CLI world.

GNU Autoconf
Ethan McCallum
Build processes can be frustratingly brittle. If you find yourself making predictable, repetitive changes to your build procedure to suit a given environment, Autoconf may be for you.

IOStreams Storage
Maciej Sobczak
Creating additional data storage for stream objects allows you to create custom stream manipulators, among other things. Maciej shows us how to design such storage.

Friendship and the Attorney-Client Idiom
Alan R. Bolton
The much-maligned "friend" declaration comes with its share of pitfalls. Alan shows how to use friendship to enhance encapsulation while minimizing the risks.

TinC
Pete Gray
Pete ports, enhances, and extends the Tiny compiler to make it a C-based, pcode-generating, target-neutral compiler.

Examining Objective-C
Kyle Dawkins
Objective-C is an object-oriented strict superset of C and is the language of choice for development with Mac OS X or the GNUStep Foundation classes.

Ch: A C/C++ Interpreter for Script Computing
Harry H. Cheng
Ch is a complete C interpreter that supports all language features and standard libraries of the ISO C90 Standard, but extends C with many high-level features such as string type and computational arrays as first-class objects.

Flexible C++ #13: Beware Mixed Collection/Enumerator Interfaces
Matthew Wilson
When the semantics of collection and enumerator interfaces are blurred, either through mistakes that we (the programmers) make, or by less-than-optimal design of the interfaces themselves, things can get hairy.

Single Inheritance Classes in C
Ron Kreymborg
When C++ compilers don't exist for some processors, inheritable classes in C may be the best solution.

Programming for Reliability
Andy Chou
Lessons learned from static analysis of millions of lines of code

Detecting Potential Deadlocks
Tomer Abramson
To avoid deadlocks, Tomer explains how to use tools that detect potential deadlocks each time code is executed.

Sorting in Java & C#
David K. Perelman-Hall
David uses reflection to sort a list of complex types using both Java and C#.

Recursive Descent, Tail Recursion, & the Dreaded Double Divide
Truck Smith
What can you do when the wrong answer turns out to be right?

STL and TR1: Part I
Pete Becker
The TR1 implementation of the Standard Template Library contains new data collections and callable types. To understand these, it's important to grasp some fundamentals of the design of the STL.

The Perils of Violating Abstractions
Andrew Koenig, Barbara E. Moo
Some programming abstractions seem like they can safely be violated. There are reasons, however, why you should think twice before doing so--a little self-discipline can have big payoffs.

Policy-Based Memory Allocation
Andrei Alexandrescu
The way your application allocates memory can have a dramatic effect on its performance. Modern general-purpose memory allocators are pretty efficient, but there's always room for improvement.

C++/CLI Input/Output
Rex Jaeschke
Rex covers the ABCs of reading and writing in the .NET/CLI realm, including screen and keyboard I/O, file and string I/O, and operations on files and directories.

GraphViz and C++
Nikos Platis, Mihalis Tsoukalos
The Boost Graph Library (BGL) is a great way to use GraphViz to draw directed and undirected graphs of your data structures.

Hierarchical State Machine Design in C++
Dmitry Babitsky
In a Hierarchical Finite State Machine, any state can be a substate of some larger state. Dmitry presents a class that implements this pattern.

Adapting Interface-Incomplete Types at Compile Time
Matthew Wilson
When an adapter template makes demands that a potential underlying type cannot fulfill, Interred Interface Adaptation can expand the number of adaptable types.

Mixed-Language Programming & External Linkage
Giri Mandalika
Calling C code from C++ should be relatively straightforward, but understanding the concept of linkage is key to ensuring a smooth compile.

A Flexible Framework for Error Reporting
Terence Parker
Errors can often occur deep in a class or subroutine, but the way you present that error should ideally be dependent on context. The solution is to separate error generation from error reporting.

Compile-Time Assertions & Debugging
Klaus Wittlich
It's common practice to use assertions to check invariants at runtime, but assertions can be equally useful at compile time for doing things like checking arrays for proper size and order.

Unit Testing & CxxTest
Eric Gufford
Unit testing can save you time and catch bugs early in the development cycle, but it can be tedious to set up. CxxTest is a framework that uses Perl to automate the creation of test classes for your application.

<algorithm>: find_end
Bjorn Karlsson
Bjorn covers search, search_n and find_end, which are all useful in finding subsequences.

Amazon Web Services
Ashish Muni, Justin Hansen
ScanZoom lets you use mobile camera phones to launch services by taking photos of barcodes.

Wide-Character Format String Vulnerabilities
Robert C. Seacord
Robert presents strategies for handling format string vulnerabilities in C.

A Mac Text Editor Migrates to Intel
Tom Thompson
BBEdit, an industrial-strength Macintosh text editor, has been ported to the Intel platform. Here's how.

Rapid Data Access Tier Implementation
John Cheng, Abdul Akbari, Hong Rong
DBAG is a tool for automating the creation of domain-specific classes.

New Products

New Products November 2005.

Pointers and Iterators: Off the Deep End
Herb Sutter
When it comes to pointers and iterators, it can't be said enough: Stay away from undefined behavior. It will come back to bite you.

An Efficient Variant Type
Christopher Diggins
Variant types are useful, but there's a performance penalty when using boost::any. Christopher presents a faster alternative.

Revolutionize Your UI
John Torjo
Manipulating surfaces is a good way to gain control of the look-and-feel of your GUI components.

Weak Pointers
Pete Becker
Sometimes, an application needs a pointer that doesn't affect the lifetime of the resource it points to. TR1 provides a weak_ptr for this purpose.

Argument-Dependent Return-Type Variance
Matthew Wilson
Matthew goes a step beyond simple overloading with Argument-dependent Return-type Variance.

C++/CLI Threading: Part II
Rex Jaeschke
Rex continues his discussion of the C++/CLI threading implementation, focusing on shared variables during concurrent operations, thread-local storage, and interlocked operations.

C++ Smart Pointers & Tags
Edward Walker
Efficient recovery of reference-counted pointers is crucial to recovery after a shutdown. The key is avoiding object duplication.

Remoting in .NET Framework 2.0
Vikram Srivatsa
.NET Framework 2.0 brings some changes to Remoting, .NET's communication mechanism, and more changes are on the way. Make sure your code is up to date.

Sharing Memory with the Virtual Machine
Toby Opferman
VMWare allows you to run multiple operating systems on one host, but there are some tricks to sharing data among these OS instances and the host.

Soft Real-Time Programming with Linux
William Nagel
The 2.6 kernel brought a host of real-time enhancements to Linux, making it "good enough" for many soft real-time applications.

The CustomTreeView ASP.NET 2.0 Server Control
Shahram Khosravi
CustomTreeView is a server control derived from the ASP.NET 2.0 TreeView server control that is used to display hierarchical data.

Editor's Forum
P.J. Plauger
Creeping complexity is everywhere these days. It's not enough to keep selling a successful product; each new version must do all the things its predecessor did and a few more.

Programmer's Book Review
Peter N. Roth
Peter examines Effective C#: 50 Specific Ways to Improve Your C# and C# Precisely.

More Bad Pointers
Pete Becker
Pete continues last month's discussion of the new TR1 template class shared_ptr.

When Types Contain Data
Andrew Koenig, Barbara E. Moo
C++ features that allow types to vary during compilation also allow compile-time computation on numbers. This can have useful side effects.

Walking Down Memory Lane
Andrei Alexandrescu
Andrei discusses some fundamental principles behind resource management in C++—in particular, how you should approach it, what options C++ offers, in what ways memory is different from other resources, and how all that influences the way you approach your designs.

C++/CLI Threading: Part I
Rex Jaeschke
C++/CLI supports the ability to create multiple threads of execution within a single program. Rex covers the creation and synchronization of threads in C++/CLI.

The Perl-Compatible Regular Expressions Library
Ethan McCallum
The Perl-Compatible Regular Expressions Library gives you the pattern-matching power of Perl in your C and C++ programs.

Managed String Library for C
Robert Seacord
Standard Library string functions like strcpy() are not considered secure by today's standards. The Managed String Library is one possible solution.

Bitstream Parsing in C++
Edward Bishop
Mask-and-shift operations for bitstream parsing can be tedious and error prone. Edward presents several ways to improve upon the traditional approaches.

Event Dispatching & the GED Library
Bo Xu
Event dispatchers can vary greatly across applications and platforms. Bo presents a Generic Event Dispatcher library that corrals the commonalities among event-dispatching mechanisms.

Static Analysis, Security Holes, & Networking Code
Andy Chou
Static analysis, which examines source code at compile time, is an effective tool for spotting security flaws. However, scaling it to large codebases is a challenge.

Asynchronous I/O Streams for TCP Connections
Claus Tondering
C++ I/O Streams can make reading and writing TCP sockets as easy as reading and writing to the console--and even allow for asynchronous I/0.

Strong Language
Ed Nisley
Large, complex embedded systems have more places for things to go wrong.

Pointer Containers
Thorsten Ottosen
Smart containers are useful and safe utilities that can lead to flawless object-oriented programming.

Removing Memory Errors from 64-Bit Platforms
Rich Newman
It's crucial to address potential memory errors before porting to 64-bit platforms.

Calling C Library DLLs from C#
Shah Datardina
Need to utilize legacy software? Here are techniques for calling unmanaged code written in C from C#.

<algorithm>: find
Bjorn Karlsson
Bjorn continues his series on the Algorithms Library of the C++ Standard with a discussion of find, which is designed to locate specific elements in a sequence.

Unsmart Pointers: Part II
Christopher Diggins
Christopher introduces some specialized deletable unsmart pointer class templates.

Revolutionize Your UI
John Torjo
Windows should only implement their logic, while surfaces implement the drawing of the UI.

Footprints in the Butter: Part II
Matthew Wilson
In his previous installment, Matthew focused on code bloat in source code. This month, he looks at object code size.

Bad Pointers
Pete Becker
If you've never had to track down a program failure caused by a bad pointer, well, you're in for some treats.

C++/CLI: Cloning
Rex Jaeschke
C++/CLI "cloning" capabilities let you make copies of heap-based objects.

The Embedded C Extension to C: Part II
Marcel Beemster, Hans van Someren, Willem Wakker, Walter Banks
In this installment of this two-part article, our authors present an example use of the Embedded C language extensions.

Determinant Algorithm Generation with Numlists
Michael A. Jones
Numlists provide the compile-time index list structures that allow processing to happen in place. The compile-time nature of template recursion is key to coding this algorithm.

Implementing Splay Trees in C++
Ralf Mattethat
Splay trees are self-adjusting binary search trees that are typically used in caches, memory allocators, routers, garbage collectors, data compression, and the like.

The Ordersort Algorithm
Matthew Aitkenhead, Mark Richards
Ordersort is a list-sorting algorithm that's simple to implement in C++, and that sorts lists faster than the Quicksort and Bubblesort algorithms.

Eclipse CDT 3.0 Released
Jonathan Erickson
Sebastien Marineau, Eclipse CDT project lead, discusses Eclipse CDT 3.0's new features. (MP3 Audio, 4:08 mins.)

C++ Exceptions & the Linux Kernel
Halldór Ísak Gylfason, Gísli Hjálmtysson
C++ kernel-level runtime support for Linux lets you use the full power of C++ in kernel-space programming.

Improving Performance with Custom Pool Allocators for STL
Anthony Aue
Anthony presents a highly flexible and configurable replacement for C++'s std::allocator for use with node-based standard containers.

<algorithm>: for_each
Bjorn Karlsson
In the first in his series on the Algorithms Library of the C++ Standard, Bjorn covers for_each, a terse alternative to writing your own loops.

Trip Report: April 2005
Herb Sutter
On the road again with Herb as he reports on the ISO C and C++ Standards meetings—and what that means for the future of C and C++.

On the Newsstand


Table of Contents
Order this issue now.
Subscribe to DDJ

Departments

64bit
AI
Architecture & Design
C++
Database
Eclipse & Open Source
Embedded Systems
Global Developer
Java
Lightweight Languages
Linux/UNIX
Mobility
Security
SOA, Web Services & XML
Testing & Debugging
Windows/.NET

CMP DevNet Spotlight

Programming for Reliability
Lessons learned from static analysis of millions of lines of code

In the News

DDJ Newsletters

Dr. Dobb's Linux Digest Newsletter
edited by Steven Gibson
A monthly compendium that will highlight the most important Linux discussions happening in usenet groups as well as on the Web.
--more--

DDJ Resources

Mobilized Software
Developer Events

DevNet Podcasts

Antarctica: Eclipse Comes In From the Cold
Josh Reed discusses the Antarctic Geologic Drilling Program, and the important role that open source tools played.

Software Glitch Implicated in Mars Global Surveyor Failure
NASA Watch reports that NASA's Mars Global Surveyor stopped responding to commands a few months ago due to improperly coded software.

Info-Link

DDJ Store


Dr. Dobb's Developer Library DVD: Release 2
The Dr. Dobb's Developer Library DVD is a new fully searchable DVD that includes 17 years of Dr. Dobb's Journal, 14 full years of C/C++ Users Journal, 3 years of The Perl Journal, nearly 4 years of Dr. Dobb's Sourcebook, and thousands and thousands of lines of source code—all on one DVD!

Click here for more information.

 




MarketPlace

Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.

Instant Answers to Your IT & Business Questions
Sign Up & Get Full Access To The Definitive Online Book Collection With SkillSoft's Books24x7�.

Discover WinDev 11 RAD
and develop 10 times faster ! ALM, IDE, .Net, PDF, 5GL, Database, 64-bit, etc. Free Express version

Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.

Wanna see your ad here?