C history - peek()?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob Nelson

    C history - peek()?

    After completing a good book on C (KNK's 2nd edition), I dusted off an oldie
    for a good laugh or two. It's Traister's ``Mastering C Pointers'' and I am
    aware of just how bad this book it. See my posting from 10 years ago here
    in c.l.c.

    Knowing the dubious quality of the book, what he writes on page 78 may be
    fiction (but there's a chance it may have been true):

    ``The original C programming language contained a peek() function [...]''

    Is there any basis in fact for this questionable statement? dmr? bwk?
  • Dann Corbit

    #2
    Re: C history - peek()?

    "Bob Nelson" <bnelson@nelson be.comwrote in message
    news:g27ndd$1s5 $1@renpen.nelso nbe.com...
    After completing a good book on C (KNK's 2nd edition), I dusted off an
    oldie
    for a good laugh or two. It's Traister's ``Mastering C Pointers'' and I am
    aware of just how bad this book it. See my posting from 10 years ago here
    in c.l.c.
    >
    Knowing the dubious quality of the book, what he writes on page 78 may be
    fiction (but there's a chance it may have been true):
    >
    ``The original C programming language contained a peek() function [...]''
    >
    Is there any basis in fact for this questionable statement? dmr? bwk?
    No.

    The 1976 C reference manual:


    The 1967 BCPL reference manual:
    🔑Surf like a Boss! Unleash the indomitable power of our lightning-fast, rock-solid VPN shield. Maximum cybersecurity and privacy protection. Built on WireGuard


    No peek() whatsoever.


    ** Posted from http://www.teranews.com **

    Comment

    • Walter Banks

      #3
      Re: C history - peek()?



      Bob Nelson wrote:
      After completing a good book on C (KNK's 2nd edition), I dusted off an oldie
      for a good laugh or two. It's Traister's ``Mastering C Pointers'' and I am
      aware of just how bad this book it. See my posting from 10 years ago here
      in c.l.c.
      >
      Knowing the dubious quality of the book, what he writes on page 78 may be
      fiction (but there's a chance it may have been true):
      >
      ``The original C programming language contained a peek() function [...]''
      >
      Is there any basis in fact for this questionable statement? dmr? bwk?
      PEEK and POKE was a basic thing. There were a few old C compilers
      that added PEEK and POKE intrinsics as extensions. cc65 has peek
      and poke macro's in one of the header files and I believe that one of the
      C compilers for Radio Shack color computer had PEEK and POKE
      intrinsics

      AFAIK none of the early main stream compilers supported PEEK and
      POKE. I just checked The Small C Handbook by Hendrix and it
      doesn't document a PEEK and POKE.

      w..





      Comment

      • Default User

        #4
        Re: C history - peek()?

        Walter Banks wrote:
        PEEK and POKE was a basic thing. There were a few old C compilers
        that added PEEK and POKE intrinsics as extensions. cc65 has peek
        and poke macro's in one of the header files and I believe that one of
        the C compilers for Radio Shack color computer had PEEK and POKE
        intrinsics
        >
        AFAIK none of the early main stream compilers supported PEEK and
        POKE. I just checked The Small C Handbook by Hendrix and it
        doesn't document a PEEK and POKE.
        Depends on what you mean by early mainstream. Turbo C had them,
        including peekb() and pokeb() for byte access.



        Brian

        Comment

        • Richard Tobin

          #5
          Re: C history - peek()?

          In article <48485759.393BC 74D@bytecraft.c om>,
          Walter Banks <walter@bytecra ft.comwrote:
          >PEEK and POKE was a basic thing. There were a few old C compilers
          >that added PEEK and POKE intrinsics as extensions.
          This must be some strange 8086 stuff. On sensible architectures (or
          even good implementations on odd ones) you just use *(type *)address.

          -- Richard
          --
          In the selection of the two characters immediately succeeding the numeral 9,
          consideration shall be given to their replacement by the graphics 10 and 11 to
          facilitate the adoption of the code in the sterling monetary area. (X3.4-1963)

          Comment

          • CBFalconer

            #6
            Re: C history - peek()?

            Richard Tobin wrote:
            Walter Banks <walter@bytecra ft.comwrote:
            >
            >PEEK and POKE was a basic thing. There were a few old C compilers
            >that added PEEK and POKE intrinsics as extensions.
            >
            This must be some strange 8086 stuff. On sensible architectures (or
            even good implementations on odd ones) you just use *(type *)address.
            However most languages do not bandy about the process of creating
            pointers or dereferencable addresses. Hiding this extension
            operation in procedures/functions allows the implementor to control
            the action.

            --
            [mail]: Chuck F (cbfalconer at maineline dot net)
            [page]: <http://cbfalconer.home .att.net>
            Try the download section.


            ** Posted from http://www.teranews.com **

            Comment

            • Walter Banks

              #7
              Re: C history - peek()?



              Richard Tobin wrote:
              In article <48485759.393BC 74D@bytecraft.c om>,
              Walter Banks <walter@bytecra ft.comwrote:
              >
              PEEK and POKE was a basic thing. There were a few old C compilers
              that added PEEK and POKE intrinsics as extensions.
              >
              This must be some strange 8086 stuff. On sensible architectures (or
              even good implementations on odd ones) you just use *(type *)address.
              I think the only purpose was for customers that were
              translating basic programs who had little familiarity
              with C. The cc65 definitions were as you suggested

              #define POKE(addr,val) (*(unsigned char*) (addr) = (val))
              #define PEEK(addr) (*(unsigned char*) (addr))

              they also had PEEK and POKEW for ints.

              w..







              Comment

              • Mike Smith

                #8
                Re: C history - peek()?


                "Dann Corbit" <dcorbit@connx. comwrote in message
                news:db7e1$4848 372b$6993@news. teranews.com...
                "Bob Nelson" <bnelson@nelson be.comwrote in message
                news:g27ndd$1s5 $1@renpen.nelso nbe.com...
                After completing a good book on C (KNK's 2nd edition), I dusted off an
                oldie
                for a good laugh or two. It's Traister's ``Mastering C Pointers'' and I
                am
                aware of just how bad this book it. See my posting from 10 years ago
                here
                in c.l.c.

                Knowing the dubious quality of the book, what he writes on page 78 may
                be
                fiction (but there's a chance it may have been true):

                ``The original C programming language contained a peek() function
                [...]''

                Is there any basis in fact for this questionable statement? dmr? bwk?
                >
                No.
                >
                The 1976 C reference manual:
                >
                http://www.fh-jena.de/~kleine/histor...enceManual.pdf
                >
                The 1967 BCPL reference manual:
                🔑Surf like a Boss! Unleash the indomitable power of our lightning-fast, rock-solid VPN shield. Maximum cybersecurity and privacy protection. Built on WireGuard

                >
                No peek() whatsoever.
                >
                >
                ** Posted from http://www.teranews.com **
                But peek() does exist in the "B" language, which is often regarded
                as a pre-cursor to "C".




                Comment

                • Ben Bacarisse

                  #9
                  Re: C history - peek()?

                  "Dann Corbit" <dcorbit@connx. comwrites:
                  "Bob Nelson" <bnelson@nelson be.comwrote in message
                  news:g27ndd$1s5 $1@renpen.nelso nbe.com...
                  >After completing a good book on C (KNK's 2nd edition), I dusted off an
                  >oldie
                  >for a good laugh or two. It's Traister's ``Mastering C Pointers'' and I am
                  >aware of just how bad this book it. See my posting from 10 years ago here
                  >in c.l.c.
                  >>
                  >Knowing the dubious quality of the book, what he writes on page 78 may be
                  >fiction (but there's a chance it may have been true):
                  >>
                  >``The original C programming language contained a peek() function [...]''
                  >>
                  >Is there any basis in fact for this questionable statement? dmr? bwk?
                  >
                  No.
                  >
                  The 1976 C reference manual:
                  http://www.fh-jena.de/~kleine/histor...enceManual.pdf
                  Both the question and this part of your answer miss an important
                  point. In those early days, there was no "standard" C library. As a
                  systems programming language, it seemed natural that every system
                  would provide a library that interfaced to whatever was "there".
                  There was a GCOS C library, an IBM 370 C library, a Unix C library...

                  For this reason, the document you cite does not list the library
                  functions. It talks about some of them, but it does not claim to list
                  those that should be available on all (or even most) C
                  implementations . It states: "The UNIX Programmer s Manual [4]
                  describes the library routines available to C programs under UNIX..".

                  --
                  Ben.

                  Comment

                  • user923005

                    #10
                    Re: C history - peek()?

                    On Jun 6, 5:25 am, "Mike Smith" <mikesmit...@no .spam.btconnect .com>
                    wrote:
                    "Dann Corbit" <dcor...@connx. comwrote in message
                    >
                    news:db7e1$4848 372b$6993@news. teranews.com...
                    >
                    >
                    >
                    "Bob Nelson" <bnel...@nelson be.comwrote in message
                    news:g27ndd$1s5 $1@renpen.nelso nbe.com...
                    After completing a good book on C (KNK's 2nd edition), I dusted off an
                    oldie
                    for a good laugh or two. It's Traister's ``Mastering C Pointers'' and I
                    am
                    aware of just how bad this book it. See my posting from 10 years ago
                    here
                    in c.l.c.
                    >
                    Knowing the dubious quality of the book, what he writes on page 78 may
                    be
                    fiction (but there's a chance it may have been true):
                    >
                    ``The original C programming language contained a peek() function
                    [...]''
                    >
                    Is there any basis in fact for this questionable statement? dmr? bwk?
                    >
                    No.
                    >
                    The 1976 C reference manual:
                    >
                    http://www.fh-jena.de/~kleine/histor...-CReferenceMan...
                    >
                    >
                    >
                    The 1967 BCPL reference manual:
                    http://cm.bell-labs.com/cm/cs/who/dmr/bcpl.pdf
                    >
                    No peek() whatsoever.
                    >
                    ** Posted fromhttp://www.teranews.co m**
                    >
                    But peek() does exist in the "B" language, which is often regarded
                    as a pre-cursor to "C".
                    >
                    http://www.thinkage.ca/english/gcos/...ib/0peek.html- Hide quoted text -
                    C was not derived from B. C was derived from BCPL:
                    🔑Surf like a Boss! Unleash the indomitable power of our lightning-fast, rock-solid VPN shield. Maximum cybersecurity and privacy protection. Built on WireGuard

                    Comment

                    • Mike Smith

                      #11
                      Re: C history - peek()?

                      >"user923005 " <dcorbit@connx. comwrote in message
                      news:9413d077-d428-43ac-b8d2->97bce51b53d5@5 6g2000hsm.googl egroups.com...
                      >On Jun 6, 5:25 am, "Mike Smith" <mikesmit...@no .spam.btconnect .com>
                      >wrote:
                      >"Dann Corbit" <dcor...@connx. comwrote in message
                      >>
                      >news:db7e1$484 8372b$6993@news .teranews.com.. .
                      >>
                      >>
                      >>
                      "Bob Nelson" <bnel...@nelson be.comwrote in message
                      >vnews:g27ndd$1 s5$1@renpen.nel sonbe.com...
                      After completing a good book on C (KNK's 2nd edition), I dusted off
                      an
                      oldie
                      for a good laugh or two. It's Traister's ``Mastering C Pointers'' and
                      I
                      >am
                      aware of just how bad this book it. See my posting from 10 years ago
                      >here
                      in c.l.c.
                      >>
                      Knowing the dubious quality of the book, what he writes on page 78
                      may
                      >be
                      fiction (but there's a chance it may have been true):
                      >>
                      ``The original C programming language contained a peek() function
                      >[...]''
                      >>
                      Is there any basis in fact for this questionable statement? dmr? bwk?
                      >>
                      No.
                      >>
                      The 1976 C reference manual:
                      >>
                      >http://www.fh-jena.de/~kleine/histor...-CReferenceMan...
                      >>
                      >>
                      >>
                      The 1967 BCPL reference manual:
                      >http://cm.bell-labs.com/cm/cs/who/dmr/bcpl.pdf
                      >>
                      No peek() whatsoever.
                      >>
                      ** Posted fromhttp://www.teranews.co m**
                      >>
                      >But peek() does exist in the "B" language, which is often regarded
                      >as a pre-cursor to "C".
                      >>
                      >http://www.thinkage.ca/english/gcos/...lib/0peek.html
                      >C was not derived from B. C was derived from BCPL:
                      >http://cm.bell-labs.com/who/dmr/chist.html
                      The link you quote seems to contradict your assertion:

                      "For the sake of brevity, I omit full descriptions of C itself,
                      its parent B [Johnson 73] and its grandparent BCPL [Richards 79],"

                      As parent, "B" would appear to be closer to "C" than is grandparent, BCPL?



                      Comment

                      • Keith Thompson

                        #12
                        Re: C history - peek()?

                        user923005 <dcorbit@connx. comwrites:
                        On Jun 6, 5:25 am, "Mike Smith" <mikesmit...@no .spam.btconnect .com>
                        wrote:
                        [...]
                        >But peek() does exist in the "B" language, which is often regarded
                        >as a pre-cursor to "C".
                        >>
                        >http://www.thinkage.ca/english/gcos/...lib/0peek.html
                        >
                        C was not derived from B. C was derived from BCPL:
                        http://cm.bell-labs.com/who/dmr/chist.html
                        From which:

                        For the sake of brevity, I omit full descriptions of C itself, its
                        parent B [Johnson 73] and its grandparent BCPL [Richards 79], and
                        instead concentrate on characteristic elements of each language
                        and how they evolved.

                        C was derived from B, which in turn was derived from BCPL.

                        --
                        Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
                        Nokia
                        "We must do something. This is something. Therefore, we must do this."
                        -- Antony Jay and Jonathan Lynn, "Yes Minister"

                        Comment

                        • user923005

                          #13
                          Re: C history - peek()?

                          On Jun 6, 12:55 pm, "Mike Smith" <mikesmit...@no .spam.btconnect .com>
                          wrote:
                          "user923005 " <dcor...@connx. comwrote in message
                          >
                          news:9413d077-d428-43ac-b8d2->97bce51b5__BEG IN_MASK_n#9g02m G7!__...__END_M ASK_i?a63jfAD$z __@56g2000hsm.g ooglegroups.com ...
                          >
                          >
                          >
                          >
                          >
                          On Jun 6, 5:25 am, "Mike Smith" <mikesmit...@no .spam.btconnect .com>
                          wrote:
                          "Dann Corbit" <dcor...@connx. comwrote in message
                          >
                          >news:db7e1$484 8372b$6993@news .teranews.com.. .
                          >
                          "Bob Nelson" <bnel...@nelson be.comwrote in message
                          vnews:g27ndd$1s 5$1@renpen.nels onbe.com...
                          After completing a good book on C (KNK's 2nd edition), I dusted off
                          an
                          oldie
                          for a good laugh or two. It's Traister's ``Mastering C Pointers'' and
                          I
                          am
                          aware of just how bad this book it. See my posting from 10 years ago
                          here
                          in c.l.c.
                          >
                          Knowing the dubious quality of the book, what he writes on page 78
                          may
                          be
                          fiction (but there's a chance it may have been true):
                          >
                          ``The original C programming language contained a peek() function
                          [...]''
                          >
                          Is there any basis in fact for this questionable statement? dmr? bwk?
                          >
                          No.
                          >
                          The 1976 C reference manual:
                          >>
                          The 1967 BCPL reference manual:
                          http://cm.bell-labs.com/cm/cs/who/dmr/bcpl.pdf
                          >
                          No peek() whatsoever.
                          >
                          ** Posted fromhttp://www.teranews.co m**
                          >
                          But peek() does exist in the "B" language, which is often regarded
                          as a pre-cursor to "C".
                          >>
                          The link you quote seems to contradict your assertion:
                          >
                          "For the sake of brevity, I omit full descriptions of C itself,
                          its parent B [Johnson 73] and its grandparent BCPL [Richards 79],"
                          >
                          As parent, "B" would appear to be closer to "C" than is grandparent, BCPL?
                          Yes, C came from B, I misspoke.
                          However, neither the BCPL nor the C reference I gave have a peek()
                          function.
                          If peek() came to some C and B variants, it came later. If someone
                          can provide a reference for C from the progenitors earlier than the
                          one I gave {it dates to 1976} that has peek() in it, I will believe
                          it. I did not start programming in C until 1984, but there was no
                          peek() in any of the 6 or so flavors of C I was using at the time. I
                          suspect that peek() came along much later as some sort of perversion
                          for making BASIC users happy.

                          Comment

                          • Spiro Trikaliotis

                            #14
                            Re: C history - peek()?

                            Hello Walter,

                            Walter Banks wrote:
                            The cc65 definitions were as you suggested
                            ^^^^

                            Why 'where'? cc65 is still actively maintained, the latest versoin
                            2.12.0 is from April 2008: http://www.cc65.org/news.php

                            Of course, cc65 is not a full C compiler (cf.
                            http://www.cc65.org/index.php#Features), but it is really "near to it".

                            Regards,
                            Spiro.

                            --
                            Spiro R. Trikaliotis http://opencbm.sf.net/
                            http://www.trikaliotis.net/ http://www.viceteam.org/

                            Comment

                            • Walter Banks

                              #15
                              Re: C history - peek()?



                              Spiro Trikaliotis wrote:
                              Hello Walter,
                              >
                              Walter Banks wrote:
                              >
                              The cc65 definitions were as you suggested
                              ^^^^
                              >
                              Why 'where'? cc65 is still actively maintained, the latest versoin
                              2.12.0 is from April 2008: http://www.cc65.org/news.php
                              >
                              Of course, cc65 is not a full C compiler (cf.
                              http://www.cc65.org/index.php#Features), but it is really "near to it".
                              cc65 had its origins many years ago when
                              PEEK and POKE was a popular feature
                              of Basic the then most popular programming
                              language. I had not followed cc65's continued
                              development over the years.

                              w..


                              Comment

                              Working...