September 5, 2001

DevX - Software Development Resource

Avoid Unused Command Line Arguments

Many code wizards and automated source code generators synthesize the following main() template, even if the application doesn’t use command line arguments: int main(int argc, char* argv[]){ return 0;} This

DevX - Software Development Resource

Constructor Call Sequence

The constructors in a class hierarchy execute in the following sequence: base class constructors are called first, then member object’s constructors, and finally, the constructor of the derived class executes.

DevX - Software Development Resource

Disabling Further Derivation of a Class

Although the advantages of disabling further derivation of a class are often doubtable, C++ allows you to do that by declaring a class’s constructor and other special member functions private.

DevX - Software Development Resource

The auto Keyword

‘auto’ is undoubtedly the least used C++ keyword. This is because it’s always redundant. auto indicates local automatic storage type, for example: int main(){ auto int x; auto char s[10];}

DevX - Software Development Resource

Detecting the vptr’s Location

The precise location of the vptr (the pointer to the class’s table of virtual functions’ addresses) is implementation-dependent. Some compilers, e.g., Visual C++ and C++ Builder, place it offset 0,

DevX - Software Development Resource

Dividing a JList

Normally, a list of items in a Java application is presented in a JList or JComboBox. If all of the listed items are created equally, the list handles them quite

DevX - Software Development Resource

Auto Start an Application from the Registry

Here is an example of how to make your application auto start from the registry.The code also shows how to query and clear this. ‘Module: Module1 Option Explicit Private Const