devxlogo

January 29, 2000

float or double?

For most uses, double is the default floating-point data type to be used. Variables of type double offer higher accuracy and minimize truncation and deviation to a minimum. This is

Be Careful With Transient Data

Java’s serialization provides an elegant, and easy to use mechanism for making an object’s state persistent. While controlling object serialization, we might have a particular object data member that we

Memory Leaks and Their Prevention

A memory leak occurs when an application fails for some reason to release dynamic memory that was allocated using new or malloc().The application won’t reclaim the allocated memory because both

Preventing the Creation of Temporary Objects

The compiler inserts temporary objects “behind your back” in several contexts. For time critical applications, the overhead of a temporary can be quite significant because both the constructor and the

Rules of Thumb for Designing Exception Classes

When designing an exception class, think of it as a standalone class with data members and member functions. A well-designed exception class should have a member function that returns a

Dynamic Memory Allocations and Thread Safety

In general, the global new and delete operators are implemented in a thread-safe manner: each invocation of either operator locks the heap before performing the allocation/deallocation of memory and when