Tip Bank

DevX - Software Development Resource

Empty Exception Specification

Some programmers tend to add an empty exception specification to constructor destructor, assignment operator, and copy constructor of a class: class C {public: C() throw(); ~C() throw(); C(const C&) throw();

DevX - Software Development Resource

Use Unadvertised Controls

When you open VB5’s Components list, you’ll see many controls and libraries not available for your development. Some are controls you downloaded from Web pages; others come from who knows

DevX - Software Development Resource

Overloading Operators for enum Types

For some enum types, it may be useful to define overloaded operators, such as ++ and –, that can iterate through the enumerator values: #include using namespace std;enum Days {Mon,

DevX - Software Development Resource

Const and Reference Data Members Must be Initialized

A class may have const and reference data members. These members must be explicitly initialized by a member-initialization list: class Allocator{private: const int chunk_size; const string & serialization_path; // file

DevX - Software Development Resource

Activate Single Control on All Tabs

A single object, employing a single set of event routines, may be used across all pages in the SSTab control. Draw the object on the form that contains the SSTab

DevX - Software Development Resource

Delegate Generic Event Handling

It can be useful to create generic controls of similar properties. For example, if a project has 10 textboxes on different forms that need to accept numeric input only, instead

DevX - Software Development Resource

Easily Determine Whether a Recordset is Empty

Use this quick and dirty routine to help find empty recordsets: Public Function IsEmptyRecordset(rs As Recordset) As Boolean IsEmptyRecordset = ((rs.BOF = True) And (rs.EOF = True))End Function

DevX - Software Development Resource

Remove Unwanted Characters

When working with or fixing Access databases and Excel spreadsheets created by users at my company, I often have to use their strings from the table or spreadsheet to save