// archives

C/C++

This category contains 5 posts

Run-Time Type Identification (RTTI)

It is legal and sometimes necessary to cast a derived class pointer into base class pointer. This is also called upcast but by doing so the type information of the pointer gets lost.

Modifying Hardware Capability (HCAP) Bits of an Object File

Many times in order to optimize software performance programmers use specific compiler flags that generate code tuned to a given hardware architecture. In fact, at times we’d write tight loops in assembly using processor specific instructions to squeeze that extra bit of performance. The peripheral code in “C” or C++ can [...]

Tip to debug a multi threaded solaris program

Solaris thread library enables extra error checking when environmental variable _THREAD_ERROR_DETECTION is set to 1 or 2.

Efficient Way To Fork sub-Processes

Using a fork() system call, followed by an exec() system call is the common way to spawn a sub-process from an application. The fork() call makes a copy of the entire parent process’ address space, thus requiring two times the memory used by the parent process.

C Macro For Printing Filename And Line Number

Most C compilers provide the macros __FILE__ and __LINE__ that can be used to print the source file name and line number respectively. These macros come in handy when printing debug information or when using printf() as a general purpose tool for debugging.