473,385 Members | 1,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

"Mastering C Pointers"....

Hey guys, I'm new here, just a simple question.

I'm learning to Program in C, and I was recommended a book called,
"Mastering C Pointers", just asking if any of you have read it,
and if it's worth the $25USD.

I'm just looking for a book on Pointers, because from what I've
read it's one of the toughest topics to understand.

thanks in advanced.

sincerely ... Andy
Nov 13 '05
388 21366
"Alan Connor" <zz****@xxx.yyy> wrote in message
news:uR*****************@newsread4.news.pas.earthl ink.net...
On Mon, 3 Nov 2003 22:32:56 GMT, Default User <fi********@boeing.com.invalid> wrote:


Alan Connor wrote:

[Richard Heathfield]
Well, you just crossed the line with that bit of deceitful and sophomoric trolling.


You are making a huge mistake. Richard is a frequent posters, a textbook
author and a well-respected member of this newsgroup.

Roose, on the other hand, is a troll who willing dispenses erroneous
information and replies with flames when challenged.

I suggest you reverse your decision. Killfile Roose, do not do the same
with Richard.


Brian Rodenborn

Why do you assume that I lack both eyes and common sense?


No assumptions are necessary. Your posts and Richard's serve
as concrete evidence for Brian's conclusion.


Richard and a few others have done almost nothing but attack Roos since
the thread began.
They have originally attacked the incorrect information, which
is a valuable pursuit in any technical forum. Perhaps they
have later 'attacked' Roose himself, but that is only in response
to personal attacks which *he* initiated. Read the thread.


That's the only troll-like behavior I have seen here.
You sir, obviously don't know what a troll is.

Everything Roos has told me has been verified by my research on the
Net and with local docs.
The 'Net' and 'local docs' do not determine correctness of
assertions about the C language. The *only* source for such
determination is the C langauge standard, ISO 9899.

Roos has been helpful,
I found his 'advice' to be quite harmful, *especially* for the
novice, who won't know that his statements are incorrect.
much more so than Richard (although that one post
was indeed excellent)
Were I to rank the usefulness and correctness of the articles
of the regulars here, Richard would certainly occupy one of the
top ten positions, perhaps the top five.

Richard's buddies have mostly posted material that's way over my head
The fact that you don't understand something makes it useless?
Perhaps it might initially, but you know you *can* ask for further
explanation, clarification, elaboration, etc, don't you?

I've often seen a novice write that he did not understand something
an 'expert' wrote, who asked for further clarification, and *got it*,
to his satisfaction. Whereupon the expert was *thanked*, not *attacked*
as Roose does.

and
just confuses me if I let it.
Exactly, 'if you let it'. If you don't understand something, continue
to ask questions, read books, etc.. I suspect even the great Heathfield
uses this method.


At least Roos knows that a novice doesn't know the lingo yet.
And avoiding the correct technical terms only serves to perpetuate
the ignorance of the novice.


Yet you are telling me the opposite is true.
As am I.


We'll see. But trolling gets anyone killfiled for a while.
Regardless of the 'diplomacy' or accurateness of Richard's articles,
they certainly do not represent trolling. The posts by Roose and
yourself represent trolling.
I don't care
if it's being done by Dennis Ritchie.


And we don't care what you care about.

Bye now.

-Mike
Nov 13 '05 #351

"Alan Connor" <zz****@xxx.yyy> wrote in message
news:XF*****************@newsread4.news.pas.earthl ink.net...
On Tue, 4 Nov 2003 01:50:04 -0600, Randy Howard

<ra**********@FOOmegapathdslBAR.net> wrote:


In article <bo**********@hercules.btinternet.com>,
do******@address.co.uk.invalid says...
Alan Connor wrote:

<snip>

> We'll see. But trolling gets anyone killfiled for a while. I don't care > if it's being done by Dennis Ritchie.

Ah, the irony! The exquisite irony!


*cackle*

--
Randy Howard _o
2reply remove FOOBAR \<,
______________________()/ ()______________________________________________ SCO Spam-magnet: po********@sco.com


I really don't like watching people masturbate in public.

Killfiled for 60 days.


Oh dear, I'm sure that now Randy is in tears. I'd best hurry
over with a tissue and comfort him.

-Mike
Nov 13 '05 #352

"Roose" <no****@nospam.nospam> wrote in message
news:S%****************@newssvr27.news.prodigy.com ...
or data (a simple int, char; an array; a struct or union; a
block of malloc'd memory) can be pointed at.

^^^^^^^^^^^^^^^^^^^
Better: ... can be designated by an lvalue.


That's better for you. Not better for a newbie. I would love to see some
beginner ask you about C programming, and you start blathering on about
lvalues.


"Way back when", when I was first learning C, the 'discovery' of
and subsequent understanding of lvalues, was a great day and
was a *huge* help in my understanding of the language.

And this 'discovery' was 'stumbled' upon, during the quest for
a specific answer about something else. The fact that I was
actually looking for something else did not cause me to disregard
the valuable information I'd just acquired.

Just a thought....
-Mike
Nov 13 '05 #353
Richard Heathfield wrote:
Being killfiled by such people is like having your car registration
number written down in an eight-year-old car-spotter's notebook as
you pass under the trollbridge at seventy mph. You don't actually
notice the event all that much, and it certainly doesn't affect
your life, but it makes /his/ day, and that's what matters.


Heh. Good analogy!

Pretty much exactly what *I* thought when *you* killfiled me.

--
|_ CJSonnack <Ch***@Sonnack.com> _____________| How's my programming? |
|_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL |
|_____________________________________________|___ ____________________|
Nov 13 '05 #354
Mark Gordon wrote:
Top posting, on the other hand, makes it a real pain for everyone..
No, not everyone. I have no problem with it whatsoever. My brain
has little trouble figuring out the conversation, and if the thing
is really screwed up, I can easily Go Ogle the orginals (assuming
they aren't available on the local server).

Top posting offers the *advantage* of giving me a peek at what the
poster has to say immediately. All the easier for me to determine
if the post is worth reading.

For example, most news readers (even OE) allow you to page through
messages on a group by just hitting the space bar. With bottom
posting this works, but if a message is top posted then to see the
context you have to page down though the post...
Bah. Every newsreader I've ever used had a single keystroke that
meant "go to next post".
So ALL the arguments against top posting are still valid.


Nonsense. It's more an attempt to control the environment. Good
on you if you can pull it off, but don't assume it's a mandate or
The One True Way.

It's just A Way.

--
|_ CJSonnack <Ch***@Sonnack.com> _____________| How's my programming? |
|_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL |
|_____________________________________________|___ ____________________|
Nov 13 '05 #355

"Alan Connor" <zz****@xxx.yyy> wrote in message
news:rR*****************@newsread4.news.pas.earthl ink.net...
On Mon, 03 Nov 2003 18:50:09 -0500, Sheldon Simms <sh**********@yahoo.com>

wrote:


On Mon, 03 Nov 2003 21:29:12 +0000, Alan Connor wrote:
Got really fed up with the Richard fellow. Killfiled his arrogant ass for a while.


You are of course welcome to killfile anyone you want, however you
should be aware that Richard is telling you the truth and Roose is
not. At least, he is not telling you the whole truth.


And all the people that ARE, are doing nothing but confuse me.


IOW, "Truth confuses me. Thus I reject it, in favor of untruth,
which I do understand."

-Mike
Nov 13 '05 #356
Programmer Dude wrote:
Richard Heathfield wrote:
Being killfiled by such people is like having your car registration
number written down in an eight-year-old car-spotter's notebook as
you pass under the trollbridge at seventy mph. You don't actually
notice the event all that much, and it certainly doesn't affect
your life, but it makes /his/ day, and that's what matters.


Heh. Good analogy!

Pretty much exactly what *I* thought when *you* killfiled me.


Oh, I'd forgotten about that. Well, my motivation was slightly different. I
could think of no better way to indicate the strength of my feeling on the
matter at hand. I must admit I was hoping you'd be sufficiently concerned
by it to re-examine the issue, but obviously that never happened. And, of
course, I eventually had to unplonk you because, in /technical/ discussions
about programming, I value your contribution so highly. It seems that we
are fated to be on opposite sides of non-programming discussions, though.

--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 13 '05 #357
Richard Heathfield wrote:
Lew Pitcher wrote:

August Derleth wrote:
Le*********@td.com (Lew Pitcher) wrote in message
news:<3f***************@news21.on.aibn.com>.. .

<snip>
Those old machines were rather interesting, especially where the
designers kind of knew what they really wanted but had to work around
the hardware to get something close.


Funny thing is, those "old" machines are still cranking out the data.

Surely you mean "cranking /in/ the data"?

Data is (or are!) what you put into a computer. What it cranks out is
information. Well, that's the general idea, anyway.


So, what name do you give to the results that come out of one computer to go
into another computer?

Let me guess: "a file".

<grin>

From "Websters New Dictionary and Thesaurus", (c) 1990

data n pl (now often with sing verb) facts, statistics, or information
either historical or derived by calculation or experimentation.

It seems that "data" is another word for "information", meaning that both of
us are correct: data goes in and information (aka data) comes out.
--
Lew Pitcher

Master Codewright and JOAT-in-training
Registered Linux User #112576 (http://counter.li.org/)
Slackware - Because I know what I'm doing.

Nov 13 '05 #358
On Tue, 04 Nov 2003 07:59:07 +0000, Alan Connor wrote:
On Tue, 4 Nov 2003 01:18:34 -0600, Randy Howard <ra**********@FOOmegapathdslBAR.net> wrote:


In article <%Q*******************@newssvr21.news.prodigy.com> ,
no****@nospam.nospam says...
Chris, I enjoyed reading your post and there is definitely interesting
information here. But I would contend that if someone doesn't yet have a
good understanding of pointers, he won't have the foggiest idea what you're
talking about. : )


Roose, if you want to be a moderator of a newsgroup, why do you not go
start one and see how many sheep wish to join your flock?


That's completely unfair. You could just as well paint Richard with the
same brush.

This is transparent character assassination. Do you think we are stupid?


Stupid is an understatement. The odds that two imbeciles would discover
one another on c.l.c are so great, that I think it much more likely that
"Alan Connor" is an invention of "Roose"!
Nov 13 '05 #359
On Sat, 08 Nov 2003 18:15:12 GMT, Jim Showalter <ji***********@hotmail.com> wrote:


On Tue, 04 Nov 2003 07:59:07 +0000, Alan Connor wrote:
On Tue, 4 Nov 2003 01:18:34 -0600, Randy Howard <ra**********@FOOmegapathdslBAR.net> wrote:


In article <%Q*******************@newssvr21.news.prodigy.com> ,
no****@nospam.nospam says...
Chris, I enjoyed reading your post and there is definitely interesting
information here. But I would contend that if someone doesn't yet have a
good understanding of pointers, he won't have the foggiest idea what you're
talking about. : )

Roose, if you want to be a moderator of a newsgroup, why do you not go
start one and see how many sheep wish to join your flock?


That's completely unfair. You could just as well paint Richard with the
same brush.

This is transparent character assassination. Do you think we are stupid?


Stupid is an understatement. The odds that two imbeciles would discover
one another on c.l.c are so great, that I think it much more likely that
"Alan Connor" is an invention of "Roose"!


I'm happy for you. Now shut the fuck up and get the hell out of my life
you stupid punk.

killfiled for 90 days. The other post goes unread.

--
Alan C this post ends with w
q
Nov 13 '05 #360
Alan Connor wrote:
Now shut the fuck up and get the hell out of my life
you stupid punk.
What an erudite vocabulary you have. Have you ever considered civility as an
alternative to scatology? It is a much more pleasant way to communicate.
killfiled for 90 days. The other post goes unread.


He will be devastated to learn that. Simply devastated.

--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 13 '05 #361
On Fri, 7 Nov 2003 07:56:20 +0000 (UTC), in comp.lang.c , Richard
Heathfield <do******@address.co.uk.invalid> wrote:
goose wrote:


(I wrote)
BUAATOO, IR.


??


Yeah, that's got me stumped as well.


but u are about the only one, I reckon
tia :-)


In my country, that's the name of a drink. :-)


ice in mine, please, maria

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 13 '05 #362
On Fri, 7 Nov 2003 07:46:34 +0000 (UTC), in comp.lang.c , Richard
Heathfield <do******@address.co.uk.invalid> wrote:
Mark McIntyre wrote:
The Standard disagrees with you.
I disagree that it disagrees. In order to compare p to NULL, you must
convert p to a pointer type (see quote above, plus 6.3.2.3-4). I'm
doubtful that you could convert a null pointer constant to a pointer
type without storing it somewhere....


You make a better case than I thought existed.


ha!
Lacking the time right now to make a detailed study of the matter,
certainly, Pierre. :-)
Would you suggest that, say, 0 is an object?


<ot>
At the risk of sinking my own battleship, not if its a literal. IME
its converted cheaply into either a handy zero byte or nothing at all
in machine code, thus being a non-addressable item.
CMP A1,0
JNE 0xDEAD:BEEF
EVAL A1
JZ 0xFFFF:F000
</ot>

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 13 '05 #363
In article <de********************@comcast.com>,
James Hu <jx*@despammed.com> wrote:
On 2003-11-07, Christian Bau <ch***********@cbau.freeserve.co.uk> wrote:
In article <bo**********@elf.eng.bsdi.com>,
Chris Torek <no****@elf.eng.bsdi.com> wrote:
On a typical RISC we get something like:

mov x, reg # assuming x is already in a register
asr reg, 31, reg # where asr is arithmetic shift right
and reg, 3, reg # for divisor == 4
add reg, x, reg
asr reg, 2, reg # again for divisor == 4
# final result is now in "reg"


On a PowerPC, you get:
int test (int x) { return x / 4; }

00000000: 7C601670 srawi r0,r3,2 // r0 = r3 >> 2
00000004: 7C600194 addze r3,r0 // r3 = r0 + 0 + carry
00000008: 4E800020 blr // Return


Can someone remind me what the on-topic lesson was? Here's my stab:

* For unsigned integral types, shift vs. multiply/divide by powers
of 2 are equivalent in C.
* For signed integral types, shift vs. multiply/divide by powers
of 2 in C depends on the implementation. If you want strictly
conforming code, you must use divide.

Did I get that right?


Not quite. For signed integral types, the result of a right shift for
negative numbers is implementation defined, and right shift by (n) is
usually not the same as division by 2^n. If you want a division, you
must divide. If you want a right shift, you must right shift. You
usually don't want a right shift.

Some people try to "optomize" by replacing division by a power of two
with a right shift. (I used the word "optomize" because it is usually
not a worthwhile optimization and a surprisingly high number of people
using this technique can't spell "optimize" correctly). The result: For
negative numbers, it is usually incorrect. For positive numbers, the
savings are tiny. For unsigned values, there is no saving.

You should also note that for negative numbers, you really have to
figure out what result you really want. C integer division rounds
towards zero (in C99. I think in C90 it was implementation defined for
negative values). However, quite often you want to round down, even for
negative values, and then a C division doesn't give the result you want.
Nov 13 '05 #364
On 7 Nov 2003 12:38:43 GMT, in comp.lang.c , Joona I Palaste
<pa*****@cc.helsinki.fi> wrote:
Roose must be one of those who believe it is right to teach people to
do things the wrong way first, and then later tell them out of the
blue: "Everything I previously taught you is wrong! Forget all about
it! Do things this way instead!". I can never understand how such
teaching could possibly be more favourable than teaching how to do
things right from the start.


Well, TBH, having taught both 1st year undergrads and school kids, I
can see the virtues of this approach. It makes little sense to try to
teach eleven year olds quantum mechanics and wave theory, unless they
first have some inkling of the periodic table and chemical reactions.
It works better to teach people in much the same way that we
historically discovered it - chemicals, molecules, atoms, subatomic
particles, wave theory, quarks, strings... or whatever.

Thats not to say that teaching programming beginners utter tripe is my
recommendation. By all means start by teaching them how to read
punched cards tho, then progress on to hand-crafted assembler on an
11/780 or a 68000 :-)

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 13 '05 #365
On Fri, 07 Nov 2003 12:21:25 -0600, in comp.lang.c , Programmer Dude
<Ch***@Sonnack.com> wrote:
No, not everyone. I have no problem with it whatsoever.
An twere not you, this would have engendered a flame response. As it
is, my toasting fork is at the ready.
is really screwed up, I can easily Go Ogle the orginals (assuming
they aren't available on the local server).
What, you are happy to waste *your* time finding out stuff others were
discurteous enough to snip out? Gah. Thats like paying terrorists
off... :-)
Top posting offers the *advantage* of giving me a peek at what the
poster has to say immediately. All the easier for me to determine
if the post is worth reading.


Indeedy. Darwinian I call it. Come to think on it, maybe we should
*encourage* it amongst certain posters here...
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 13 '05 #366
Mark McIntyre wrote:
Richard Heathfield wrote:
Would you suggest that, say, 0 is an object?


At the risk of sinking my own battleship, not if its a literal.


Yeah, that was kind of my point. :-)

--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 13 '05 #367
On Fri, 7 Nov 2003 07:50:10 +0000 (UTC), in comp.lang.c , Richard
Heathfield <do******@address.co.uk.invalid> wrote:
Mark McIntyre wrote:
Hmmmm. I find this distinction highly artificial.


Data are the raw materials of information.


Indeed. But I consider data to be both what goes into a computer
(example: some graphs I digitised for my DPhil thesis) and comes out
(example: some tables of stress/strain analysis that I generated from
the digitised graphs). Both form information.

Data need, indeed, not even reach a computer in the first place. The
cricket scores in the college ground next to my house are undoubtedly
data, but I strongly suspect that they never go nearer a computer
than they are to my study, given the antiquity of both the scorer and
the pavilion scoreboard. I'm generally surprised that such a decrepit
old guy can lift those heavy metal plates to hang them on the hooks,
and that, having got them there, he's not brained by them when they
fall off again, the hooks being so rusty... :-)

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 13 '05 #368
Groovy hepcat Mark McIntyre was jivin' on Mon, 03 Nov 2003 23:46:35
+0000 in comp.lang.c.
Re: "Mastering C Pointers"....'s a cool scene! Dig it!
On Mon, 03 Nov 2003 20:39:39 GMT, in comp.lang.c , Alan Connor
<zz****@xxx.yyy> wrote:
Killfiled for N days.


I'm sorry, did you just killfile RJH?


He wouldn't be the first. Lots of trolls plonk the clueful regulars
here. It's what trolls do when they find they can't argue with reason.

--

Dig the even newer still, yet more improved, sig!

http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?
Nov 13 '05 #369
"Christian Bau" <ch***********@cbau.freeserve.co.uk> wrote in message
news:ch*********************************@slb-newsm1.svr.pol.co.uk...
[useful stuff snipped]
Some people try to "optomize" by replacing division by a power of two
with a right shift. (I used the word "optomize" because it is usually
not a worthwhile optimization and a surprisingly high number of people
using this technique can't spell "optimize" correctly).


<ot>
Oh. And my 1st impession was you've used it because it rhymes
with "lobotomize" ;-)
</ot>
[snip]

Thanks to everyone for information.
Nov 13 '05 #370
On Sat, 8 Nov 2003 23:33:10 +0000 (UTC), in comp.lang.c , Richard
Heathfield <do******@address.co.uk.invalid> wrote:
Mark McIntyre wrote:
Richard Heathfield wrote:
Would you suggest that, say, 0 is an object?


At the risk of sinking my own battleship, not if its a literal.


Yeah, that was kind of my point. :-)


And I revert to my point - as the Standard says, a null pointer
constant must be converted to a pointer type before it can be compared
to a pointer. I still reckon that conversion requires storage.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 13 '05 #371
On Sat, 08 Nov 2003 19:59:14 +0000, Alan Connor wrote:
On Sat, 08 Nov 2003 18:15:12 GMT, Jim Showalter <ji***********@hotmail.com> wrote:

Stupid is an understatement. The odds that two imbeciles would discover
one another on c.l.c are so great, that I think it much more likely that
"Alan Connor" is an invention of "Roose"!
I'm happy for you. Now shut the fuck up and get the hell out of my life
you stupid punk.


That's the whong answer.

Think about it: if Alan Connor is a real person, unconnected to Roose,
his reply would be one of incrediblity at such an assertion. Instead, he
reacts with genuine anger - like a thief caught in the act.

killfiled for 90 days. The other post goes unread.


Oh dear - I'll be counting the days.

Wonder what he meant by "The other post goes unread."?
jim
--
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/
_/ I'm all for computer dating, but I wouldn't want my sister to marry
_/ one.
_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Nov 13 '05 #372
On Sun, 09 Nov 2003 01:07:07 +0000, Mark McIntyre wrote:
On Sat, 8 Nov 2003 23:33:10 +0000 (UTC), in comp.lang.c , Richard
Heathfield <do******@address.co.uk.invalid> wrote:
Mark McIntyre wrote:
Richard Heathfield wrote:

Would you suggest that, say, 0 is an object?

At the risk of sinking my own battleship, not if its a literal.


Yeah, that was kind of my point. :-)


And I revert to my point - as the Standard says, a null pointer
constant must be converted to a pointer type before it can be compared
to a pointer. I still reckon that conversion requires storage.


I agree that the conversion must take place, but I don't agree
that it requires storage. A null pointer constant exists in source
code, but neither the null pointer constant nor the null pointer
need to exist at all in an executable program/object file/library,
etc. The conversion takes place in the compiler and may end up
being a conceptual conversion rather than an actual conversion.

For example, the code:

char * p;
...
if (p != 0) /* <-- here's a null pointer constant */
{
do_stuff();
}
do_other_stuff();

might be translated:

tst r9 ;evaluate p and set flags
beq .L54
bsr do_stuff
..L54:
bsr do_other_stuff

No null pointer, object or value, at all.


Nov 13 '05 #373
Mark McIntyre wrote:
On Sat, 8 Nov 2003 23:33:10 +0000 (UTC), in comp.lang.c , Richard
Heathfield <do******@address.co.uk.invalid> wrote:
Mark McIntyre wrote:
Richard Heathfield wrote:

Would you suggest that, say, 0 is an object?

At the risk of sinking my own battleship, not if its a literal.


Yeah, that was kind of my point. :-)


And I revert to my point - as the Standard says, a null pointer
constant must be converted to a pointer type before it can be compared
to a pointer. I still reckon that conversion requires storage.


Well, that's already been answered elsethread.

Your original point, with which I originally disagreed, was "(&a) in that
context is an expression. To be a pointer, it would have to be stored in
something. ."

Now, you already agree that &a is an expression that is not stored in
something. Great. You're right. Now let's see if we can work out, purely
from reference to the Standard, whether &a is also a pointer.

6.5.3.2 says:

"The unary & operator returns the address of its operand. If the operand has
type "type", the result has type "pointer to type".

QED.
--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 13 '05 #374
Mark McIntyre <ma**********@spamcop.net> scribbled the following:
On Fri, 7 Nov 2003 07:56:20 +0000 (UTC), in comp.lang.c , Richard
Heathfield <do******@address.co.uk.invalid> wrote:
goose wrote: (I wrote)
BUAATOO, IR.

??


Yeah, that's got me stumped as well.

but u are about the only one, I reckon


No wonder it got us stumped. I never thought you Mark would write in
h4x0r d00dsp33k.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"The day Microsoft makes something that doesn't suck is probably the day they
start making vacuum cleaners."
- Ernst Jan Plugge
Nov 13 '05 #375
On 9 Nov 2003 09:48:54 GMT, in comp.lang.c , Joona I Palaste
<pa*****@cc.helsinki.fi> wrote:
Mark McIntyre <ma**********@spamcop.net> scribbled the following:
On Fri, 7 Nov 2003 07:56:20 +0000 (UTC), in comp.lang.c , Richard
Heathfield <do******@address.co.uk.invalid> wrote:
goose wrote:

(I wrote)
> BUAATOO, IR.

??

Yeah, that's got me stumped as well.

but u are about the only one, I reckon


No wonder it got us stumped. I never thought you Mark would write in
h4x0r d00dsp33k.


Fat fingers - should have been a Y....
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 13 '05 #376
On Sun, 9 Nov 2003 06:45:53 +0000 (UTC), in comp.lang.c , Richard
Heathfield <do******@address.co.uk.invalid> wrote:

"The unary & operator returns the address of its operand. If the operand has
type "type", the result has type "pointer to type".


You got me. However I now use a cunning manoeuvre, and note that the
original expression had no side-effects and would have been removed by
the compiler during optimisation. So it still wasn't a pointer !! :-)
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 13 '05 #377
Mark McIntyre <ma**********@spamcop.net> scribbled the following:
On 9 Nov 2003 09:48:54 GMT, in comp.lang.c , Joona I Palaste
<pa*****@cc.helsinki.fi> wrote:
Mark McIntyre <ma**********@spamcop.net> scribbled the following:
On Fri, 7 Nov 2003 07:56:20 +0000 (UTC), in comp.lang.c , Richard
Heathfield <do******@address.co.uk.invalid> wrote:
goose wrote:
(I wrote)
>> BUAATOO, IR.
>
> ??

Yeah, that's got me stumped as well.
but u are about the only one, I reckon


No wonder it got us stumped. I never thought you Mark would write in
h4x0r d00dsp33k.

Fat fingers - should have been a Y....


OK, I see.
Hmm, how about a VCR tape containing sample episodes of that quiz show
you and Richard are so fond of? It sounds so eccentrically British, I
want to see what it looks like.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"This is a personnel commuter."
- Train driver in Scientific American
Nov 13 '05 #378
On 9 Nov 2003 20:56:41 GMT, in comp.lang.c , Joona I Palaste
<pa*****@cc.helsinki.fi> wrote:
Hmm, how about a VCR tape containing sample episodes of that quiz show
you and Richard are so fond of?
Err... Its a radio show.
It sounds so eccentrically British, I
want to see what it looks like.


it would certainly be eccentric to watch it. white noise video
perhaps? :-)
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 13 '05 #379
Mark McIntyre <ma**********@spamcop.net> scribbled the following:
On 9 Nov 2003 20:56:41 GMT, in comp.lang.c , Joona I Palaste
<pa*****@cc.helsinki.fi> wrote:
Hmm, how about a VCR tape containing sample episodes of that quiz show
you and Richard are so fond of?
Err... Its a radio show.


A cassette then. It'll be cheaper and all.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"Hasta la Vista, Abie!"
- Bart Simpson
Nov 13 '05 #380
Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message news:<bo**********@oravannahka.helsinki.fi>...
Ian Woods <ne******@wuggynocaps.org> scribbled the following:
Joona I Palaste <pa*****@cc.helsinki.fi> wrote in
news:bo**********@oravannahka.helsinki.fi:
Richard Heathfield <do******@address.co.uk.invalid> scribbled the
following:
goose wrote:
> Mark McIntyre <ma**********@spamcop.net> wrote in message
> news:<j9********************************@4ax.com>. ..
>> BUAATOO, IR.
>
> ?? Yeah, that's got me stumped as well.

But Understanding Ain't Always That Object-Oriented, I Remember.
What do I win? =)

Could someone give the FARG a call (if they're still around), we have a new
cognitive-science challenge for them!


Sorry, I don't understand. What's the FARG?


Frequently Answering/Responding Groups ???

goose,
Nov 13 '05 #381
On 10 Nov 2003 08:17:12 GMT, in comp.lang.c , Joona I Palaste
<pa*****@cc.helsinki.fi> wrote:
Mark McIntyre <ma**********@spamcop.net> scribbled the following:
On 9 Nov 2003 20:56:41 GMT, in comp.lang.c , Joona I Palaste
<pa*****@cc.helsinki.fi> wrote:
Hmm, how about a VCR tape containing sample episodes of that quiz show
you and Richard are so fond of?

Err... Its a radio show.


A cassette then. It'll be cheaper and all.


the wonders of modern technology

http://www.bbc.co.uk/comedy/clue/clips/

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
Nov 13 '05 #382
Irrwahn Grausewitz wrote:
(snip)
(about Alan Connor)

I had some spare time and did a quick google groups search. If you're
only interested in the highlights, do a search for threads that have his
name in the _subject-line_. For the full load perform a search for
articles he posted. It's real fun.


Wow ! I'm impressed ! Everyone should have a look !
Bruno

Nov 13 '05 #383
Chris Torek wrote:

(As an aside: on modern operating systems, "memory" is usually an
illusion anyway. The OS will *simulate* a nice linear sequence of
bytes, but it does so with "pages" that are "paged in" and "paged
out" to/from some form of "backing store" -- typically on disk --
and shuffled and reshuffled without any individual program, whether
coded in C or any other language, being able to see what is happening.
The hardware must provide a certain amount of assistance to let
the OS know what a program is trying to do, and the OS then determines
whether the code is doing something "normal" and "allowed", and if
so, arranges to allow it. The OS can then also determine whether
the program is running amok, and if so, stop it. While large chunks
of OSes can be written in nothing other than strictly conforming
C code, parts *must* be written using stuff outside the C standard,
and often must be hand-coded in assembly. These include the parts
that talk with hardware to find out what the various user programs
are attempting.)


Are you talking about accessing memory through segmented memory spaces
by segment registers or access through the virtual memory page table? or
both?

Thanks..qb

P.S. Fascinating post by the way.
Nov 13 '05 #384
On 5 Nov 2003 01:19:30 -0700, Chris Torek <no****@elf.eng.bsdi.com>
wrote:
Chris Torek <no****@elf.eng.bsdi.com> writes:
For something really different, I would suggest trying[list of

"different" machines]

In article <3F***************@yahoo.com> CBFalconer <cb********@yahoo.com>
writes:
Shouldn't the HP3000 running MPE fit in there somewhere? I
believe it just became unsupported. Many Burroughsisms. It DID
have a C compiler 25 years ago.


Well, 25 years ago was 1987, which predates ANSI C, but mainly I
did not list it because I never used it nor even read much about
it. (I have not used the AS/400 either, but I have read a bit from
those who have.) I think certain Tandem machines might also fit
in the "oddball" category.

The original Tandem architecture, now known (more or less) as TNS1,
embedded as a core in the successor TNS2 which is still supported in
emulation though fading somewhat, had the (8-bit-)byte pointer versus
(16-bit-)word pointer issue. TNS1 had another (even odder?) feature,
that code is not only in a separate segment (like PDP-11 I&D-space
models) but (and still in TNS2) function pointers use a completely
different representation, so that even if a compiler is persuaded to
issue instructions to access code space using a pointer, doing so
using a function pointer doesn't get you to that function -- at best,
if you twiddle some bits, it gets you to an entry or exit vector slot
*for* the function. Of course in standard C you can't do anything with
a function pointer but remember it and call through it, which works.

And as long as someone brought up HP3k, another unusual feature of TNS
is that it does most (but not all!) computational operations in a
(register) stack-oriented fashion -- LOAD x; LOAD y; SUB; STOR z --
(very) vaguely similar to that machine. But since C never requires any
variables, even those marked 'register', to actually be in registers,
limitation on directly accessing registers is not a real problem.

- David.Thompson1 at worldnet.att.net
Nov 13 '05 #385
On 3 Nov 2003 14:54:00 -0800, li***************@yahoo.com (August
Derleth) wrote:
<snip>
Then I guess you never learned the beauty that is VAX, I suppose?
More's the pity: Understanding some of the intricacies of the DEC
minicomputers can help you grasp why some of C's crucial early design
decisions were made the way they were. For example, a flat memory
model and the whole notion of pre[increment|decrement] being usefully
different from post[increment|decrement] both came directly from the
PDPs.
Part of that seems to be an urban legend. If you believe dmr, his
2HOPL paper available at http://cm.bell-labs.com/cm/cs/who/dmr/ says
{pre,post}{inc,dec} were in B on PDP-7, which did not have them in
hardware. And PDP-11 had only postinc and predec for (primitive)
pointers, which became the idiomatic usage.

The flat memory model came from, and indeed was even stronger in,
BCPL, which AFAICT existed on mainframes before it saw any DEC, though
it seems to have become most widespread on PDP-10.
Truly, C was designed to be somewhere between PDP-11 assembly and
PL/1, but closer to assembly in some key ways.

Not PDP-11 specifically, but between the machine/assembly level of the
"average" minicomputer and something like PL/I or algol, yes; as were
several other System Implementation Languages of the day.

For what it's worth, I firmly believe that it would do most of the current crop
of "low level programmers" to learn IBM 370 Assembly language. This to find out
how to do things when you don't have a stack, aren't working in ASCII, and must
calculate with /very/ long decimal numbers. ;-)


And I think learning PDP-8 assembly is what seperates the men from the
boys, esepcially if you can only use the 8 `actual' opcodes. ;)


Well, I learned -8 assembly (really, machine) as a boy (of 15), and it
didn't aid my maturation or status. I'm not sure what you mean by that
"only" -- you have to write out IOT 031 (IIRC) instead of KSF? Is that
really a big deal? But the -10 was definitely cooler; what other
machine carefully documents which no-ops (including unsuffixed JUMP
and SKIP) are faster than others? Or where a single instruction can
take forever, due to indirection loop?

- David.Thompson1 at worldnet.att.net
Nov 13 '05 #386
>Chris Torek wrote:
(As an aside: on modern operating systems, "memory" is usually an
illusion anyway. The OS will *simulate* a nice linear sequence of
bytes ...

In article <33Csb.378617$6C4.347933@pd7tw1no>
John Kordyback <jk********@hotmail.com> writes:Are you talking about accessing memory through segmented memory spaces
by segment registers or access through the virtual memory page table? or
both?


Either, both, or perhaps even neither, depending on the hardware.

One of the recently-popular hardware methods of implementing virtual
memory uses an "inverted page table" instead of the usual
tree-structured page tables. Whether this counts as a "page table"
depends on who does the counting, as it is a "page table", but
"inverted" so not really. :-) In practice, the method is: on a
TLB miss, attach the current "unique address-space identifier" to
the virtual address, feed that through some kind of hash function,
and look in a global table entry based on the result. Expressed
in C it looks like this:

if ((found = tlb_search(id, vaddr, &paddr, &permissions)) == 0) {
index = hash(id, addr);
/*
* Hardware may do N of these, either sequential
* or rehashed.
*/
if (global_table[index].id == id &&
global_table[index].vaddr == vaddr) {
paddr = global_table[index].paddr;
permissions = global_table[index].permissions;
found = 1;
}
}
if (!found || wrong_permissions())
take_hardware_exception();

A conventional "forward" page table lookup usually divides up the
virtual address in some way and does 3 or 4 table lookups on each
piece, with each table's output being an input to the next. The
very top level table is often (but not always) called a "segment"
table.

Some hardware imposes neither "regular" nor "inverted" page tables.
MIPS and SPARC CPUs, for instance, implement only the TLB lookup
part of the process. If the TLB search misses, everything else is
up to software.

Fortunately, dealing with all this is normally an OS's job --
ordinary C code just sees ordinary, "locally flat" memory. Even
if each data object is stored in a separate segment, the contiguous
bytes that make up one object have nice linear addressing, as
handled by simple pointer arithmetic. But one could imagine a
system in which the C compiler provides the "OS-like functions" on
a modern paged CPU. Here pointer arithmetic like "p+3" might have
to consult any page tables to see if the new address is somewhere
over the rainbow.
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it http://67.40.109.61/torek/index.html (for the moment)
Reading email is like searching for food in the garbage, thanks to spammers.
Nov 13 '05 #387
Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message news:<bo**********@oravannahka.helsinki.fi>...
Mark McIntyre <ma**********@spamcop.net> scribbled the following:
On 9 Nov 2003 20:56:41 GMT, in comp.lang.c , Joona I Palaste
<pa*****@cc.helsinki.fi> wrote:
Hmm, how about a VCR tape containing sample episodes of that quiz show
you and Richard are so fond of?


Err... Its a radio show.


A cassette then. It'll be cheaper and all.


New series just started. You can listen to each episode for a
week after transmission on Monday evenings.

http://www.bbc.co.uk/radio4/comedy/clue.shtml
Nov 13 '05 #388
On 17 Nov 2003 23:28:38 -0800, in comp.lang.c , jj*@bcs.org.uk (J. J.
Farrell) wrote:

(discussing of all things, I'm Sorry, I Haven't a Clue.)
New series just started. You can listen to each episode for a
week after transmission on Monday evenings.

http://www.bbc.co.uk/radio4/comedy/clue.shtml


I especially liked the idea of singing "The Red Flag" to the tune of
"Bring me Sunshine". For those of you not familiar with the latter
song, it was the rather jolly theme tune to The Morcambe and Wise
Show, another mildly insane british comedy series.

Excuse me while I skip off into the wings with Angela Rippon.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
Nov 13 '05 #389

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

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.