OdeToCode IC Logo

C++ Habits

Monday, April 18, 2005

I came to the conclusion this week that I have at least one C++ habit I can’t kick. When I want to check an object reference for null, my fingers automatically type:

Widget woo = GetWidgetFromSomewhere();

if(woo)

{

    // …

}

     Error: Cannot implicitly convert Widget to bool.

After five years of working together, the compiler still doesn’t understand me.