473,616 Members | 2,970 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 5259
"Bob Nelson" <bn*****@nelson be.comwrote in message
news:g2******** **@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:
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.c om>,
Walter Banks <wa****@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)
Jun 27 '08 #5
Richard Tobin wrote:
Walter Banks <wa****@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 **
Jun 27 '08 #6


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



Jun 27 '08 #7

"Dann Corbit" <dc*****@connx. comwrote in message
news:db******** *********@news. teranews.com...
"Bob Nelson" <bn*****@nelson be.comwrote in message
news:g2******** **@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:
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*****@nelson be.comwrote in message
news:g2******** **@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.
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...@nelson be.comwrote in message
news:g2******** **@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:
http://cm.bell-labs.com/who/dmr/chist.html
Jun 27 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
11385
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 of data. i need it to look and see if its a double, whitespace or an operator. any suggestions? david crean
9
5430
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 dinkumware implementation (and I've reported to them as such), but the following code std::ofstream ofs("test.txt"); ofs << "0123456789"; ofs.close(); std::wifstream ifs("test.txt");
7
5629
by: Hamburgpear | last post by:
Dear All, Is it possible to reset the value of xxx.peek() after it reachs EOF ? Regards HP
1
18377
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 or change the value of the Position property, but this does not seem to affect the Peek() method, which keeps returning -1 as if it had not been notified that the stream pointer has been repositioned to file beginning. How can I let Peek() work...
1
15521
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 all the lines one more time and do the work that I'm supposed to do. The reason for this is that I have to know how many lines exists in the text file in order to display a ProgressBar to the user. I've tried setting
5
4050
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() method. Is it possible to do so in Python? Your answer would be much appreciated.
4
4489
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 the program hungs if no parameters were provided on the commandline. If I use simple redirection like "echo "hallo" | cs.exe"
0
2047
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 they're both the characters I want. I use cin.peek() to see if the first character is what I want, and if it is, I use cin.get(). Then I use cin.peek() again for the second character to see if it's what I want, and if it is, I use cin.get()...
2
2282
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 itertools.chain(short sequences) or put the short sequences as the first zip arg. To test without consuming, wrap the iterator in a trivial-to-write one_ahead or peek class such as has been posted before.
0
8203
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8146
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8449
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7121
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5550
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4141
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2579
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 we have to send another system
1
1759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1445
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.