Tip Bank

DevX - Software Development Resource

A Super-Efficient Toggle Case Using XOR

My benchmarking shows that ToggleCase can crunch through a 2,000,000character string in under 4 seconds on a Pentium II. Public Function ToggleCase(ByVal strData As String) As String ‘This technique gets

DevX - Software Development Resource

Warnings Regarding Temporaries and Their Meaning

The following code causes a somewhat cryptic warning message: struct Employee{ long ID; string name;};Employee emp;void func(int& id) { id=0;}// warning below issued for the following call:func(emp.ID);

DevX - Software Development Resource

Right-Justification of Output

To right justify the output of cout, call the width() function with the size of the output screen (in characters) as an argument. In the following example, the program calls

DevX - Software Development Resource

What You Should Include in a Header File

A header file should begin and end with #include guards to guarantee that it’s not #included more than once during the same compilation session. A typical #include guard looks as

DevX - Software Development Resource

Enumerate Collections With For Each…Next

It’s faster to enumerate a collection with the For each…Next statetment: Dim c As Class1 For Each c In Col ‘Code… NextDim fldField As ADODB.Field For Each fldField In rsTemp

DevX - Software Development Resource

Alternatives to ios::nocreate and ios::noreplace

In pre-standard C++, certain implementations of offered the flags ios::nocreate and ios::noreplace for controlling file creation. These flags were too platform-specific and never made it into the standard library, which

DevX - Software Development Resource

Standard Exit Codes

C++ defines the symbolic constants EXIT_SUCCESS and EXIT_FAILURE that you can use as return codes. These macros are defined in the header file ( in C) as follows: #define EXIT_SUCCESS