At 05:52 2006-12-28, Nico Heinze wrote:
>--- 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.

delete this;
is perfectly legal.  Somewhat unusual in where it might be used (In 
the systems I've worked on)


>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.

tsk, tsk.   your comment may apply to int, short, char, long 
etc.  but it definitely does NOT apply to things like standard 
container iterators.

>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
>
>
>
>To unsubscribe, send a blank message to 
><mailto:[EMAIL PROTECTED]>.
>Yahoo! Groups Links
>
>
>

Victor A. Wagner Jr.      http://rudbek.com
The five most dangerous words in the English language:
               "There oughta be a law" 

Reply via email to