Wednesday, March 31, 2010

Healthy to Mac turns sick on Windows !!

“ What the f**k ? “, “ Are you kidding me? “, “ What !!! ”, “ That’s very stupid !” are the sort of sentences I often listen from programmers when I pass by them at my work place. Being a novice programmer, I am puzzled and a moment think of what these guys are reprimanding at. Just out of curiosity asked one of them- “ Whom do you guys usually reprove at while programming ? “. With eyes wide open he replied, “ Its the compiler “. His answer wasn’t satisfying enough to convince until I found myself in their shoes.

Mesh sub-division is the assignment task of my graphics course. Being a mac user, I program in Xcode, an IDE similar to Visual Studio(VS) on Windows. Everything was fine until I tested the code on VS-2008. The compiler complained a run-time error and was more than puzzled to find what healthy to Mac is sick on Windows.

void

MeshClass :: GetLastVertexID( void )

{

std::list<tVertex> :: iterator iter( m_verts.end() );

lastVertexID = (*iter)->id() ;

}

Trying to dereference the end() of any list/vector is definitely a run-time error and was puzzled to see a non-garbage value present in the variable lastVertexID when debugged on Xcode. Cleaning and rebuilding the project didn’t either help the Xcode’s compiler to recognize this run-time error. The VS-2008 compiler is intelligent enough in preventing me not to dereference the end of the list. However, later rectified the mistake by decrementing the iterator once before dereferencing -

void

MeshClass :: GetLastVertexID( void )

{

std::list<tVertex> :: iterator iter( m_verts.end() );

--iter ;

lastVertexID = (*iter)->id() ;

}

The instant VS-2008 compiler complained, I was out of all foul and filthy statements that I possibly could scold. I was reluctant enough even to see the run-time error message and rather spent time in praising Mac over Windows. After much midnight oil burnt in Mac-praising, found how possibly can a Mac compiler could safely run such unsafe code. The assignment not only learnt me lesson of how compilers are different from each other but also why programmers should have many compilers on friends-list to be successful.

Results :

Saturday, March 13, 2010

" Broken Silence "

Too many americans give a voluntary-hearty-smile but never a voluntary-hearty-talk with me. Often, I think of what and how would the gap between us bridged. The hesitation of how would they receive makes me dumb even when I get a chance to break the " Silence ". Heard a lot from my friends saying americans mingle too soon when you take the brave step of opening the chat. Sometimes I convinced myself to give a try but " Silence " between us wins. Promisingly thinking of a day they asking me help would make myself win over my " Silence ". But, never thought of a year's back lucky draw won amount sponsored by Sidelines to the Office of International Affair's Coffee Hour would bring the opportunity.
While was sitting in the corner of a library came to me a Shreveport girl asking - " Do you know how to make copies over the Xerox machine ? ". It was the moment where my " Silence " was dumb enough than my strong desire to talk. I neither made use of that facility nor at least went into that room but took the advantage of helping her though being helpless. But once heard from a friend of self servicing xerox facility available in the campus provided Cajun Cash available in your account. Momentarily wished several times of the left over lucky-draw-won- spent-amount should be sufficient enough to help her and her friend. Luckily, "Silence" didn't had the last laugh this time.
It should be at least a 15 minute chat of self introduction, education-system in comparison with my country, India, future plans etc.,. Americans speaking to me by themselves is joyous enough at the moment causing pay less attention to what they actually spoke of. They paid owed amount but at the end came a sentence which left me startled. The Shreveport girl asked with her hands wide open - " Give me a hug ". How could an ardent willingness just to speak with an american feel if ended with such strange, warm feeling isn't that I could put into words. But I strongly believe, the Shreveport girl left-over impression would make myself to open conversation to leave me as a "Winner" over my "Silence" when met an american next time.