Today I submitted my first piece of code, which was a utility to down a VA controller. It is being reviewed by my team members. Was a great learning experience. learnt so many differences b/w linux and HP-UX. one main thing was the memory alignment constraint.
ptr = (unsigned int *)(&dataBuf[6]) ;
if( *ptr & mask ) // this was giving bus error(core dump)
I had to change it to
ptr = (unsigned int *)(&dataBuf[6]) ;
memcpy( &maskVal , ptr , sizeof(unsigned int) ) ;
if( *ptr & mask ) // worked fine
like this, got so many other platform dependent errors.
hoping to get to code more - i can learn more as it goes ...
Dude, watch out... Dont post ur code fragments here.
ReplyDeleteIt is confidential :-)
that was actually not a part of the code - i was just trying to figure out a way out of that problem
ReplyDeleteand there's is a mistake i've made in that piece of code posted here - can you make out what it is - really a silly mistake - due to copy pasting!