Determine calling function

D

Dave Thompson

On 20 Oct 2005 03:39:26 -0700, "James Dow Allen"
Certainly the idea of "Checking for errors" sounds logical,
but do you really test for zero before *every* division?
Or, for an absurder example, since fprintf() can fail, do you
always check its return code? That would be the reductio
ad absurdem of an insistence on checking malloc(), especially
given the frequent contexts where malloc() *won't* fail, or
where, failing, a core-dump would be as good a diagnostic as any.
<snip silly example; concur with Keith's analysis (no relation AFAIK)>

But on the serious underlying point, there is an important difference.
I/O errors fail cleanly, with no UB and setting a sticky error flag.
It is reasonable and safe to do multiple *printf without checking (but
not rewind or clearerr) and then a single ferror() test or for an
fopen'ed output file just check the fclose().

But I, and many other programmers of good taste, have the
luxury that 90% of our code will *never* run on systems
other than Unix. And, UIAM, *every* version of Unix that
uses hardware memory management will dump core whenever
an *application* writes to *(NULL).
The first "real" (by reasonable standards) Unix, PDP-11, certainly did
not. For "normal" (single-space) mode it trashed the 407 header, which
was completely ignored. For split-I&D it trashed some data, almost
certainly basic runtime stuff (which linked first). There was (IIRC in
7ed) an option for single-space with protected code (IIRC 410) that
would trap, but with <8 * 8KB segments usually at the cost of wasting
a major amount of very dear address space.

At least some of these historically important systems are available
for hobby use, and you can actually get -11 hardware on what by now
must be a tertiary market. (Aside: what comes after that? quaternary?
quadratic?) No one would choose such a system for new development
today; and even if somehow you had to run on -11 hw or architecture
(maybe spacecraft or something) you wouldn't resurrect early Unix: it
was brilliant in its day but that day was 30 years ago. Nevertheless
it does exist and is Unix.

- David.Thompson1 at worldnet.att.net
 
S

Skarmander

Dave Thompson wrote:
At least some of these historically important systems are available
for hobby use, and you can actually get -11 hardware on what by now
must be a tertiary market. (Aside: what comes after that? quaternary?
quadratic?)

Flea?

S.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top