Eclectic

About programming and maybe more…

Archive for March, 2007

Understanding make

Posted by tread on March 9, 2007

Found this nice article on make at IBM DeveloperWorks – you can read it here.

Also refer this link.

Rule:

target: dependencies
<tab>command

That’s the basic form, the first target is the default target.

Invoking “make -p” prints the internal macros for that make. This time though, I’m not going to try and make notes .. the IBM link is rather good for that.

Posted in Linux, Programming | Leave a Comment »

Interview question, this?

Posted by tread on March 1, 2007

Saw this on a message board I have started frequenting:

hi

j=1;cout<<j++<<endl<<j<<endl<<++j ;
the following code segment gives 233 as against expected 123. Can somebody explain why.

bye

Firstly, ghastly code! I wouldn’t like to hire someone who writes that!

Anyway, the C++ standard states that you cannot modify an object more than once between sequence points – the behaviour is unspecified and compiler dependent.

Posted in Programming | Leave a Comment »