May 7, 1998

DevX - Software Development Resource

The Explicit Keyword

A constructor taking a single argument is by default an implicit conversion operator: class C { int I; //… public: C(int i);//constructor and implicit conversion operator //as well }; void

DevX - Software Development Resource

Mem-initializer Evaluation Order

When initializing objects data members by a mem-initializer list, the compiler transforms the list into the order of the declaration of the data members in that class: class A {

DevX - Software Development Resource

Avoid Using malloc() and free() in C++

The use of malloc() and free() functions in a C++ file is not recommended and is even dangerous: 1. malloc() requires the exact number of bytes as an argument whereas

DevX - Software Development Resource

Use Mem-initializer to Initialize Embedded Objects

If your class contains other object(s) as members, you should initialize the embedded object(s) in a mem-initializer list instead of assigning their values inside the class constructor: class Person {

DevX - Software Development Resource

A Few Remarks About Inline Specifier

All member functions implemented within a class declaration are by default inline: //file: A.hclass A { int a; public: int Get_a() { return a; } //declaration + definition; //implicitly inline

DevX - Software Development Resource

Debugger is not Being Invoked

When working on developing or debugging an app that is created via automation (i.e. ActiveX DLL), keep in mind the following: if you invoke that app from a calling program

DevX - Software Development Resource

VB Hijacks the Registry

Be aware that the VB IDE hijacks the registry settings for your public classes when working on projects such as ActiveX DLLs and Controls. The IDE will temporarily replace (in

DevX - Software Development Resource

Using Dim Statement on Variant Arrays

When passing a variant array by reference, make sure to use Dim to declare the statement before using Redim. Example: Private Sub Command1_Click()Dim x as integer ReDim v(2) As Variant