--- In [email protected], waqas ahmed <[EMAIL PROTECTED]> wrote: > > What is the output of printf("%d") > What will happen if I say delete this? > Why preincrement operator is faster than postincrement? > What will happen if I allocate memory using "new" and free > it using "free" or allocate sing "calloc" and free it > using "delete"? <snip>
These few excerpts are IMO perfect examples of questions everyone should simply refuse to answer. Why? 1) printf( "%d") invokes undefined behaviour. 2) I'm no C++ expert, but I think "delete this;" is illegal. Victor, Paul, Thomas, et al., am I right? If so, this is another perfectly bad example. If not, thanks for explaining and please forgive me my lack of knowledge. 3) It's simply not true on most modern CPUs that a pre-increment works faster than a post-increment; the times when this was true is so long ago that it's not even worth recalling those times. This is an utterly useless question. 4) I know that many people don't trust my words here, but the result of mixing new/delete with malloc/calloc/free is compiler and runtime specific; sometimes it works without hassle, in other cases it can easily kill your server applications without any chance to find out why. So, at least these four questions do not at all make sense to ask, except to find out whether the person applying for a job knows what she's talking about. Just my 2 cents. Regards, Nico
