On Sun, Jul 17, 2011 at 7:14 PM, Rahul Menon <[email protected]> wrote:
> Today during my stroll through irc chat rooms , I came across
> http://c-faq.com/expr/seqpoints.html
>
> According to this expression like
>        i++ * i++
>
> and
>
>        i = i++
> all have undefined behavior in C.
> I thought these were among those 'tricky' questions (when these
> expressions were combined with printf functions) asked during
> interview and definitely expected to be having very much defined
> behavior!
> I think according to them , their answer should be probably with
> respect to gcc compiler.
>
> Anyway have anyone come across this thing any time during their
> programming days.. Please throw some light regarding this!

>From what I understand, these expressions are "undefined" from a
standards point of view and so, different compilers may produce
different machine code under different circumstances. See:
http://stackoverflow.com/questions/949433/could-anyone-explain-these-undefined-behaviors-i-i-i-i-i-etc

In any case, it's pretty silly to ask such questions during
interviews; specifically, they are instances of very bad programming
practice and should be avoided in real life.

Of course, if HR departments of companies go ahead and ask such
questions, then students have no option but to learn such arcane
stuff. This is so that HR people don't have to actually make an
objective or subjective choice: they resort to the absurd and useless
;)

Regards
Rajeev j Sebastian

-- 
"Freedom is the only law". 
"Freedom Unplugged"
http://www.ilug-tvm.org

You received this message because you are subscribed to the Google
Groups "ilug-tvm" group.
To control your subscription visit 
http://groups.google.co.in/group/ilug-tvm/subscribe
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]



For details visit the google group page: 
http://groups.google.com/group/ilug-tvm?hl=en

Reply via email to