devxlogo

Tip Bank

Performance of Joined Tables

Question: I have several tables with the same structure and I’m trying to combine them all into one unique table. But I’m worried about performance because each table has a

SQL Comments

Question: Can I insert comments inside a SQL query, like &#47&#42 &#42&#47 and &#47&#47in C++? Answer: SQL supports &#47&#42 and &#42&#47 for comments inside stored procedures and queries. You also

The unique() Algorithm

STL’s unique() algorithm eliminates all but the first element from every consecutive group of equal elements in a sequence of elements. unique() takes two forward iterators, the first of which

Signed Bit Fields

A bit field can be signed or unsigned. According to the C++ standard, a signed bit field may be represented in one of three ways: two’s complement one’s complement sign

Creating Immutable Constants

Although usually I don’t recommend using macros in C++ code, there are a few exceptions. One such exception is when you want to create a truly immutable constant. Consider the

Undoing a Macro

If you happen to define an object or a function or a constant whose name collides with a macro located elsewhere in a third-party header file, as in: // file

Take Advantage of Open Source Products

Open source products come with their source code files. Although you can usually install a ready-made executable file, you want to take advantage of the available source code files and

The Scope of Enumerators

The members of an enumerated type are called enumerators. For example: enum Direction { Up, // an enumerator Down // another enumerator }; int main() {} An enumerator’s scope is