Praveen's Blog

An Eternal Quest for Incremental Improvement

TDD

I have been following Test-Driven Development for a few years now. Even though TDD is widespread, often I come across a few friends who aren’t very familiar with TDD approach. It took a while for me to really appreciate TDD since I was introduced to it. When I demonstrated ...


I am casually evaluating CppUnit lately. It is pretty good. I was using the CompileOutputter as the outputter for CppUnit tests. However, the default settings for gcc is not Emacs friendly for multi-directory projects. To overcome this, I had to set the location format of the CompilerOuputter to "%p:%l ...


In the unit testing world, sometimes we encounter a situation where we need to unit test private or protected member functions. There is a lot of arguments surrounding this topic. Some claim that if a private member function needs testing, it implies that there is a need for refactoring. However ...


I always have an interest towards interview questions and puzzles, especially the programming ones. Here are some of the trivial C and C++ puzzles that I have come across. Please note that the solutions that I have given are tested, but no guarentee that they are the most efficient ones ...


I always have an interest towards interview questions and puzzles, especially the programming ones. Here are some of the trivial C and C++ puzzles that I have come across. Please note that the solutions that I have given are tested, but no guarentee that they are the most efficient ones ...


I was debugging a malfunctioning code in my project. The part of the code that I debugged involved some endian based computations. I just guessed that there might be some endian based issues in the code. But when I looked into the details of the code, they have handled the ...


One of the most common interview questions for software professionals is "How do you find a loop in a singly linked list?". Most of the people tend to think in the recursive way to solve this problem. The truth is that the most optimal solution for this problem lies out ...


In C, sometimes you want to write a C pre-processor macro that takes variable length arguments. Let me give you a practical requirement example. The requirement is that a debug log function needs to be written that takes format string and the variables as arguments and produce a debug log ...


This might be of interest for those sitting for placement. How do you swap two integers in C without creating a temporary variable ?

#include <stdio .h>
int main(void)
{
        int a = 100;
        int b = 200;

        printf("a=%d | b=%d\n",a,b);
        a ^= b ^= a ^= b;
        printf("a=%d ...