Are You Stuck In The Maintaince Programmer Mindset?

We’re all very good at pointing out whats wrong with code. There are even websites dedicated to exposing and ridiculing bad code and bad design, such as the daily wtf. We all encounter code that isn’t “right” on a daily basis, but how often do we do something about it and let our actions speak …

Continue reading ‘Are You Stuck In The Maintaince Programmer Mindset?’ »

Brain Teaser: Streaming An Enumeration In C++

Streaming an enumeratoin in C++, what could be easier? Can you spot the bug in the following code? typedef enum { SEASON_UNDEF, SEASON_SUMMER, SEASON_AUTUMN, SEASON_WINTER, SEASON_SPRING, SEASON_NUM_TYPES, } SEASON;     std::ostream& operator<<(std::ostream& rOs, const SEASON & rRhs) { switch (rRhs) { case SEASON_UNDEF: rOs << "SEASON_UNDEF"; break;   case SEASON_SUMMER: rOs << "SEASON_SUMMER"; break; …

Continue reading ‘Brain Teaser: Streaming An Enumeration In C++’ »