Tip Bank

DevX - Software Development Resource

Use of void** in QueryInterface (COM)

Question: When using Queryinterface in COM, why is the interface pointer cast to void** andwhy is it passed as a pointer to a pointer (double indirection)? Answer: This is because

DevX - Software Development Resource

Pointer to Structure

Question: I have a struct: struct mystruct{ DWORD dw_Id;}*pMystruct; In the following function I want to pass the address of ‘dw_Id’ which is a member of mystruct. How do I

DevX - Software Development Resource

RuleZero 1.2 for VID 6 Going Open Source

RuleZero 1.2, the easiest and fastest add-on tool for creating database-driven Web pages in Visual InterDev 6 is now free. You can get a copy from Vertigo Software’s site, www.vertigosoftware.com.

DevX - Software Development Resource

Handling string Exceptions

Several member functions of std::string might throw exceptions. For example, if you use a very large number to specify the initial storage size, string’s constructor will throw an exception: string

DevX - Software Development Resource

Iterators Aren’t Pointers

Suppose you define a the following list object and you need the address of one of its elements: std::list li; std::list ::iterator iter = li.begin(); In many contexts, iter functions

DevX - Software Development Resource

Calling a Member Function From a Destructor

It’s perfectly legal to call a member function?virtual or not?from a destructor. However, you should avoid calling a member function that accesses data members that have already been destroyed. For

DevX - Software Development Resource

The Order of Local Objects’ Destruction

On exit from a scope, destructors are called for all local automatic objects that are declared in that scope, in the reverse order of their declaration. For example: void f()

DevX - Software Development Resource

Understanding Default Initialization

A POD (plain old data) type is a union, struct or class with no user-declared constructors, no private or protected non-static data members, no base classes, and no virtual functions.