The 'cute' version rather famously doesn't work. It obviously fails for floating-point numbers, references, objects, and soforth. It also fails in Perl when x and y are strings---try it with $x="foo" and $y = "y" for example.

Even for integers, the value is specifically not defined by the C standard---the variable x is modified twice without an intervening sequence point, which is forbidden, and if you do it, you are not writing C. Different compilers can (and do) produce different results for this kind of expression. It might work in Perl, but the documentation doesn't say so.

See the comp.lang.c FAQ list for more details about this 'cute trick'.


In reply to Re: Potentially useful code fragment for you JAPHer's by Dominus
in thread Potentially useful code fragment for you JAPHer's by jcwren

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.