An encounter with weak typing

No Comments

There was an error reported that the application doesn’t recognize the “group” field in the table if it is the first column. And if this field is moved to the second column or beyond the the application works as expected.

We first suspected that there is a problem with the table file and spent time in analyzing the integrity of the file using various tools, but the efforts were in vain. So, I started debugging the code to understand how the application is building the group field from the table file.

The below part of the code was responsible for this wired behavior, this could have been eliminated if the function was unit tested.

if(group_position && group_length)

As C++ is a weak typed language, the if construct accepts integers as parameters.

Categories: C++, Debugging, Programming