[TUHS] Any Good dmr Anecdotes?

ron at ronnatalie.com ron at ronnatalie.com
Sun Jul 1 21:34:58 AEST 2018


Printf didn't use nargs (and still doesn't).    It looked at the presence of the % markers and assumes that’s how many arguments were passed.
It worked on the PDP-11 or any similar stack calling sequence.   It was only after C got moved to some of the more varied architectures that
VARARGS/STDARG was implemented to achieve some level of variable argument portability.   Even so, there's not a concept of "nargs" to this day.

The PDP-11 nargs was a kludge that looked at the calling code.   This obviously didn't work if you were in split I-D mode (where you couldn't address the
i-space).    There was a published hack to rewire the processor to allow MTPI to work in user mode from your OWN I space to make it work.

The bigger issue with the early printf is it just called putchar and putchar only output to stdout or what ever the global fout variable was set to.
There was a comment in the manual that the fout concept was kludgy.


-----Original Message-----
From: TUHS <tuhs-bounces at minnie.tuhs.org> On Behalf Of Dave Horsfall
Sent: Sunday, July 1, 2018 1:30 AM
To: The Eunuchs Hysterical Society <tuhs at tuhs.org>
Subject: Re: [TUHS] Any Good dmr Anecdotes?

On Sat, 30 Jun 2018, Arrigo Triulzi wrote:

> As I was told this visitor was the R in the “K&R” book I felt I could 
> finally ask “someone who knew” how printf() worked with a variable 
> number of arguments.

It wouldn't've used that awful nargs() call at that time, would it?  I was glad when that horror was removed.

-- Dave




More information about the TUHS mailing list