I have read that there is a comment preceding the task-switching code in UNIX as –
/*You are not expected to understand this*/
Humorous side of the programmer aside the comment does indicate that there are beasts out there which are difficult to exorcise, isn't?
Well, the reason I recalled the above is due to the fact that I spent sometime of the day dumbstruck reading some code. I was lead to believe I am not supposed to understand one particular huge function. I was wondering how the code execution path can be in such way the reading informed me while the actual testing showed otherwise. It was bizarre. I was telling myself that this cannot happen but the code seemed shouting loud that it was possible. But hey! Everything, even if not explainable at the outset should have some explanations and I stuck in to figure it out. Alas, it was my ignorance of some fact, simple fact.
The function that I was debugging had the following:
I wasn't aware that the brace seen above gets accounted for by the editor (vim and source-insight). The editor didn't discount the ‘}’ inside the inactive code and hence when I navigated the conditions and loops I was taken for a ride. An ‘else’ was getting matched with unrelated ‘if’ that had me perplexed. I had to stare at code and jump the loops and conditionals one by one to understand what the reason for my frustration was.
Some learning there!