I had to hit CTL-+ a couple of times to get fonts large enough that I could see the details. I see your point, but even so, this -1 return value is very strange...there can be complications with signed vs unsigned, etc.

Returning a non-zero value for an error is actually the "normal" way to do things. If I can only transmit one single number to you and that number has to combine the error code and the success status into that single number, then "success" has to mean Zero. Zero means I am completely happy. Something non-Zero is an error code. What's weird here is the -1.

This all has to do with ancient stuff. A lot of these machines only had two registers, A and B, each 16 bits. In ASM, by convention simple status would get passed back to caller via A register. PDP-11, SEL-810, NOVA-800,etc. Now if all the bits were "on" FFFF, then is that -1 or 65535?

Even the most wimpy machines will have a JNZ (jump non zero) or JZ (jump zero) instruction - it can be called something else, but there will be something like that. To detect -1 would have taken 2 instructions: one's complement(XOR), then JNZ or JZ. On a modern processor, the math unit is FAR larger than the CPU. All this happens at mind boggling rates.

Anyway, yes there is a false dichotomy concerning "true/false" values. All I can say is that it is what it is.


In reply to Re^3: How do I use a block as an ‘or’ clause instead of a simple die? by Marshall
in thread How do I use a block as an ‘or’ clause instead of a simple die? by boom

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.