On this not-so-uneventful day at work, I was suddenly thrust upon a formidable looking C++ code and I was asked to see if I can make it thread-safe.
Aah yes. How hard it can be?!
I am a CS graduate after all.
You’d think just remove those global variables and the static ones too so there aren’t any side-effects.
YOU would think.
I find myself stand before this god-forsaken C++ function wondering what perils and agony it might hold.
A function leaving aside which everything is thread-safe in my module.
A function true to its formidable name had a whole new world behind it.
A whole new world so unmistakably horrible as the one Pandora’s box unleashed, if not worse.
I trudged and trudged along the code and flew past me two glorious days.
Yet I still had no clue as to what the code was doing.. Well, I kinda knew what. ‘How‘ seemed to be more of a pertinent question.
And at one of these inopportune moments, came a gem of a thought in me.
I thought why grapple the code path; Let me take on the data path.
Yes siree, that’s a rather cheap pun on the ‘six paths of pain’.
(More so of the Naruto world than the Buddhism realms themselves :D)
And so did I.
A little plot of the data format that goes into the function and a tiny little analysis of the data that is yielded off it and a further teensy bit of analysis on the hex patterns of the two. There it was, staring right at my face, all that I ever needed.
Ahh, I am such a slave to programming! 😉
I completed my code for the transformation by the end of the day.
Makes me wonder, Am I great at reverse engineering or what?!
It pains me though, that I couldn’t comprehend the C++ in it.
Oh boy, talk of the magnitude of the blasphemy!
But what do I know?!
Remorse is all I can offer at this time; A remorse without guilt! 😛