471,089 Members | 1,294 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,089 software developers and data experts.

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?
Jun 27 '08 #1
14 4807
"Bob Nelson" <bn*****@nelsonbe.comwrote in message
news:g2**********@renpen.nelsonbe.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:
http://cm.bell-labs.com/cm/cs/who/dmr/bcpl.pdf

No peek() whatsoever.
** Posted from http://www.teranews.com **
Jun 27 '08 #2


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..

Jun 27 '08 #3
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
Jun 27 '08 #4
In article <48***************@bytecraft.com>,
Walter Banks <wa****@bytecraft.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)
Jun 27 '08 #5
Richard Tobin wrote:
Walter Banks <wa****@bytecraft.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 **
Jun 27 '08 #6


Richard Tobin wrote:
In article <48***************@bytecraft.com>,
Walter Banks <wa****@bytecraft.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..



Jun 27 '08 #7

"Dann Corbit" <dc*****@connx.comwrote in message
news:db*****************@news.teranews.com...
"Bob Nelson" <bn*****@nelsonbe.comwrote in message
news:g2**********@renpen.nelsonbe.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:
http://cm.bell-labs.com/cm/cs/who/dmr/bcpl.pdf

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".

http://www.thinkage.ca/english/gcos/...lib/0peek.html
Jun 27 '08 #8
"Dann Corbit" <dc*****@connx.comwrites:
"Bob Nelson" <bn*****@nelsonbe.comwrote in message
news:g2**********@renpen.nelsonbe.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.
Jun 27 '08 #9
On Jun 6, 5:25*am, "Mike Smith" <mikesmit...@no.spam.btconnect.com>
wrote:
"Dann Corbit" <dcor...@connx.comwrote in message

news:db*****************@news.teranews.com...
"Bob Nelson" <bnel...@nelsonbe.comwrote in message
news:g2**********@renpen.nelsonbe.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.com**

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:
http://cm.bell-labs.com/who/dmr/chist.html
Jun 27 '08 #10
>"user923005" <dc*****@connx.comwrote in message
news:9413d077-d428-43ac-b8d2->97**********@56g2000hsm.googlegroups.com...
>On Jun 6, 5:25 am, "Mike Smith" <mikesmit...@no.spam.btconnect.com>
wrote:
>"Dann Corbit" <dcor...@connx.comwrote in message

news:db*****************@news.teranews.com...
"Bob Nelson" <bnel...@nelsonbe.comwrote in message
vnews:g2**********@renpen.nelsonbe.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.com**

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?

Jun 27 '08 #11
user923005 <dc*****@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_Keith) ks***@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"
Jun 27 '08 #12
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__BEGIN_MASK_n#9g02mG7!__...__********** ************@56g2000hsm.googlegroups.com...


On Jun 6, 5:25 am, "Mike Smith" <mikesmit...@no.spam.btconnect.com>
wrote:
"Dann Corbit" <dcor...@connx.comwrote in message
>news:db*****************@news.teranews.com...
"Bob Nelson" <bnel...@nelsonbe.comwrote in message
vnews:g2**********@renpen.nelsonbe.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.com**
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?
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.
Jun 27 '08 #13
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/
Jun 27 '08 #14


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..
Jun 27 '08 #15

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by kill sunday | last post: by
9 posts views Thread by wizofaus | last post: by
7 posts views Thread by Hamburgpear | last post: by
1 post views Thread by Dan | last post: by
1 post views Thread by Shawn | last post: by
4 posts views Thread by Manfred Braun | last post: by
2 posts views Thread by Terry Reedy | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.