Registers are used primarily to hold addresses rather than data (which is more often kept in RAM), but exit codes are a special case because when a program has exited, it has cleared out of its addressing space (update: or at least is deemed to have done so by convention at a low level of operating system design) leaving only the conventional register to communicate with the shell.
Thus exit codes irrespective of what language the program might be written in are limited by operating system conventions to what can fit into a register - usually max 64 bits these days although the exact implementation is likely to have its roots in the first implementation of Unix on a 16 bit machine. At that point in time (early 1970s) the machine was the PDP-11. Its registers were numbered R0 to R11 and the exit code of any program was placed in R0, a sixteen bit register to be picked up after exit by the shell.
__________________________________________________________________________________
^M Free your mind!
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.