August 3, 2001

Serializing and Deserializing Arrays

Suppose you want to store the movements of a chess game in a file so that when the program terminates, the users can resume it later from the same point. To enable this you need to store an array that contains each player’s movements in a file, for example: for(int

What Is a Thunk?

The term thunk dates back to the days of the antediluvian Algol programming language and has stuck since then. A thunk is an invisible and parameter-less function or procedure that returns an address. A thunk isn’t implemented as a full-blown C++ function. Rather, it usually consists of one or two

DLLs and Dynamic Memory Allocation

Dynamic linking — either in the form of shared libraries in Unix or Windows DLLs — is not defined by standard C++. However, this is a widely used feature among C++ programmers. One of the peculiarities of dynamic linking is memory management. Unlike an ordinary program that has a single

Obtain Exception’s Stack Trace as String

It is sometimes necessary to get the exception’s stack trace as String (for logging, reporting, etc.). Unfortunately, the Exception class itself provides only the getMessage() method which does not include the stack trace, and the printStackTrace() methods, which do not return anything.Here’s routine that I use to obtain exception’s stack

Variadic Macros

The concept of a variable argument list is rather common: void f(const char *format,


It is often helpful to provide a

Passing a UDT(User-Defined Type) Between Forms

There is a very simple way to get around the compile error when passing UDT (user-defined type) in procedure between forms. Just declare the procedure as Friend instead of Public.Example: ‘Module: Module1Option ExplicitPublic Type Color Red As Byte Green As Byte Blue As ByteEnd Type’Form: Form1Option ExplicitPrivate Sub Command1_Click()Dim vColor

No more posts to show