October 10, 2000

DevX - Software Development Resource

Rethrowing a Throwable Exception in Your Code

Use the fillInStackTrace() method to rethrow a Throwable type of exceptional condition in your code. This is useful if you want to rethrow a exception that occurred while using a

DevX - Software Development Resource

Using dynamic_cast Properly

Programmers who use dynamic_cast sometime discover that their applications suffer from mysterious crashes although seemingly, they are bug free. In most cases, the reason is that they forgot to turn

DevX - Software Development Resource

Escape Sequences

Certain special characters are represented as escape sequences. An escape sequence begins with a (backslash) followed by an alphanumeric character. For example, the escape sequence represents the newline character. Note

DevX - Software Development Resource

Taking an Address of a Pointer

The sequence && is parsed as the logical AND operator. According to the Maximal Munch parsing principle, it’s never construed as two & (address of) operators: void func (char **

DevX - Software Development Resource

Invoking a Function Through a Pointer

When you call a function through a pointer to function, use that pointer as if it were the function itself, not a pointer. For example: #include char buff[10];void (*pf) (char

DevX - Software Development Resource

Assigning an Integer Value to an Enumeration

C++ doesn’t allow you to assign integer value to an enumeration directly: enum Direction (Up, Down};Direction dir;Dir=0; // error, can’t assign int to enum type However, you can use static_cast

DevX - Software Development Resource

Servlet Resources

Question: Where is the best place to store .property files and .xml files for servlets/jsp? Right now I am using “user.home”, but there is a problem when you have multiple

DevX - Software Development Resource

Random Number Generator

Question: Is there a way to capture the last value (digit) of the system clock number and use that to generate a random number? Or look at system clock–find last

DevX - Software Development Resource

Free Store and Heap

Question: Is there any difference between heap and free store in C++? Answer: The free store is a region of memory from which a program allocates dynamic memory using new.