Blog Archives

C++ Variable Shadowing

In C++, you can declare a variable in a derived class with the exact same name as the base class. This is allowed because each variable is properly scoped. Shadowing can lead to some fairly unpredictable behavior. Consider a class

Tagged with: , , ,
Posted in Uncategorized

std::auto_ptr best practices

One of the frustrating aspects of programming in C++ is memory management. In Java this is, in large part, handled by the garbage collector. As long as you don’t keep references lying about that you don’t need, and the GC

Tagged with: , ,
Posted in Uncategorized

Some C++ tutorials

I do lot of my development in C++. It’s not the most user-friendly of languages but it’s very powerful. Learning it can be a bear, however. If you’re really a glutton for punishment, you could start with The C++ Programming

Tagged with:
Posted in Uncategorized

Templates on HP

If you run into a compiler error like this compiling a template on HP 11.00: Error 419: “myfile.cpp”, line 5 # ‘iterator’ is used as a type, but has not been defined as a type. std::vector::iterator j; you need to

Tagged with: ,
Posted in Uncategorized

Dumping the NIS database programmatically

I recently had to get user information from a NIS domain programmatically. It’s fairly simple to dump the NIS database from the command line using ypcat. e.g. It’s just as easy to match users or UIDs using ypwhich. e.g. Unfortunately,

Tagged with: ,
Posted in Uncategorized

memory leak detection using dbx

The Solaris compiler suite ships with dbx, a source level debugger. Later versions include additional functionality to detect memory leaks and dangling blocks at program exit. The Sun guys once again designed a pretty powerful tool with a god awful

Tagged with: , ,
Posted in Uncategorized

Returning CORBA object references

The CORBA object semantics are really frustrating at times. They behave close enough to how C++ does things to make them familiar, but they differ enough to lull you into a false sense of familiarity. Your first attempt to return

Tagged with: , ,
Posted in Uncategorized

When a C++ destructor is not called

Suppose you’re following the “resource acquisition is initialization” technique where you allocate resources as part of construction. You might write classes like: The resource is allocated in the constructor when the object is instantiated and released in the destructor when

Tagged with: , ,
Posted in Uncategorized
Design a site like this with WordPress.com
Get started