[Simh] Fwd: [TUHS] An abandoned piece of K&R C

Leo Broukhis leob at mailcom.com
Fri Nov 3 16:42:01 EDT 2017


Well, somebody had to have done it!


On Fri, Nov 3, 2017 at 1:22 PM, Larry Stewart <l.simh at stewart.org> wrote:

> I took the liberty of cross posting this earlier to TUHS and I got
> an authoritative answer :)
> -Larry
>
>
> Begin forwarded message:
>
> *From: *Ken Thompson <ken at google.com>
> *Subject: **Re: [TUHS] Fwd: [Simh] An abandoned piece of K&R C*
> *Date: *2017, November 3 at 2:30:08 PM EDT
> *To: *Lawrence Stewart <stewart at serissa.com>
>
> it's news to me.
>
>
> On Fri, Nov 3, 2017 at 5:53 AM, Lawrence Stewart <stewart at serissa.com>
> wrote:
>
> This caught my attention.  Did early C really have min and max?  Were they
> used for anything?  In those days I was a BCPL user, which IIRC, did not
> have such things.
>
> -Larry
>
> Begin forwarded message:
>
> From: Leo Broukhis <leob at mailcom.com>
> Subject: [Simh] An abandoned piece of K&R C
> Date: 2017, November 3 at 1:14:42 AM EDT
> To: "simh at trailing-edge.com" <simh at trailing-edge.com>
>
> https://retrocomputing.stackexchange.com/q/4965/4025
>
>
> In the UNIX V7 version of the C language, there were the /\ (min) and the
> \/
> (max) operators. In the source of the scanner part of the compiler,
>
> case BSLASH:
>    if (subseq('/', 0, 1))
>        return(MAX);
>    goto unkn;
>
> case DIVIDE:
>    if (subseq('\\', 0, 1))
>        return(MIN);
> ...
>
> However, attempting to use them reveals that the corresponding part in the
> code generator is missing. Trying to compile
>
> foo(a, b) { return a \/ b; }
>
> results in
>
> 1: No code table for op: \/
>
> The scanner piece survived in the copies of the compiler for various
> systems
> for several years. I tried to look for copies of the code generator table
> which would contain an implementation, but failed. Has anyone ever seen a
> working MIN/MAX operator in K&R C?
>
> Thanks,Leo
>
> _______________________________________________
> Simh mailing list
> Simh at trailing-edge.com
> http://mailman.trailing-edge.com/mailman/listinfo/simh
>
>
>
>
> _______________________________________________
> Simh mailing list
> Simh at trailing-edge.com
> http://mailman.trailing-edge.com/mailman/listinfo/simh
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.trailing-edge.com/pipermail/simh/attachments/20171103/c0e92ef8/attachment.html>


More information about the Simh mailing list