473,499 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5230
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
11373
by: kill sunday | last post by:
I'm working on an RPN calculator, and i can't get the input right. I have to use cin.peek() to check the next character and do whatever i need with it. I can't get it to look for a specific type...
9
5418
by: wizofaus | last post by:
Is the any reason according to the standard that calling tellg() on an std::ifstream after a call to peek() could place the filebuf in an inconsistent state? I think it's a bug in the VC7...
7
5619
by: Hamburgpear | last post by:
Dear All, Is it possible to reset the value of xxx.peek() after it reachs EOF ? Regards HP
1
18357
by: Dan | last post by:
Hi, I'm having a problem with StreamReader.Peek(). Let's say I open a file and read it to end; then I'd want to move its stream pointer back to the file beginning: I can call BaseStream Seek method...
1
15483
by: Shawn | last post by:
Hi. I'm using this code to loop through all the lines in a text field: While myStreamReader.Peek() > -1 myStreamReader.ReadLine() i = i + 1 End While Now, what I need to do is to loop through...
5
4033
by: Avi Kak | last post by:
Hello: Does Python support a peek like method for its file objects? I'd like to be able to look at the next byte in a disk file before deciding whether I should read it with, say, the read()...
4
4480
by: Manfred Braun | last post by:
Hi All ! I think, there is a bug in the System.Console class related to use the STDIO streams. I am doing a very simple thing in a console-based program named CS Console.In.Peek(); and...
0
2029
boxfish
by: boxfish | last post by:
Hello, I'm trying to make a kind of complicated overloaded input operator in C++, and I need to look ahead a couple of characters on the input stream, and not remove them from the stream until I know...
2
2274
by: Terry Reedy | last post by:
Luis Zarrabeitia wrote: Interesting observation. Iterators are intended for 'iterate through once and discard' usages. To zip a long sequence with several short sequences, either use...
0
7134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7014
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7229
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7395
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5485
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.