Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Determine calling function

Reply
Thread Tools

Determine calling function

 
 
Dave Thompson
Guest
Posts: n/a
 
      10-30-2005
On 20 Oct 2005 03:39:26 -0700, "James Dow Allen"
<(E-Mail Removed)> wrote:
<snip>
> 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().

<snip>
> 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
 
Reply With Quote
 
 
 
 
Skarmander
Guest
Posts: n/a
 
      10-30-2005
Dave Thompson wrote:
<snip>
> 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
write a function such that when ever i call this function in some other function .it should give me tha data type and value of calling function parameter komal C++ 6 01-25-2005 11:13 AM
calling virtual function results in calling function of base class... Andreas Lagemann C++ 8 01-10-2005 11:03 PM
calling virtual function results in calling function of base class ... tiwy C++ 0 01-09-2005 11:17 PM
nuby: determine method passed and determine the receiver that received the method Peņa, Botp Ruby 1 01-24-2004 07:51 PM
Determine name /path of calling page mg ASP .Net 5 01-02-2004 04:29 PM



Advertisments