473,842 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

On Tue, 4 Nov 2003, Richard Heathfield wrote:
void PrintObjectRepr esentation(FILE *fp, void *p, size_t len)
unsigned char *objrep = p;
printf(fp, " %X", *objrep++); <============== ===== ?!
putc('\n', fp);

Is that a typo? I don't get this printf.

Nov 13 '05 #151
Alan Connor <zz****@xxx.yyy > scribbled the following:
On Mon, 3 Nov 2003 22:32:56 GMT, Default User <fi********@boe ing.com.invalid > wrote:
Why do you assume that I lack both eyes and common sense? Richard and a few others have done almost nothing but attack Roos since
the thread began.
There's a reason for that. Could you imagine that the reason Richard
and everyone else says Roose is wrong is -- wait for it -- because
That's the only troll-like behavior I have seen here.
That's *pedantry*, not *troll-like behaviour*. We like pedantry.
Everything Roos has told me has been verified by my research on the
Net and with local docs.
Which do not define the C language.
Roos has been helpful, much more so than Richard (although that one post
was indeed excellent) Richard's buddies have mostly posted material that's way over my head and
just confuses me if I let it.
The fact that you don't understand it doesn't mean it's wrong, and the
fact that you understand it doesn't mean it's right.
At least Roos knows that a novice doesn't know the lingo yet.
He doesn't know it himself, so he frequently makes mistakes, and those
who he teaches will make the same mistakes too.
Yet you are telling me the opposite is true.
We are telling you Roose is spreading false information.
We'll see. But trolling gets anyone killfiled for a while. I don't care
if it's being done by Dennis Ritchie.

If Dennis Ritchie starts trolling in here, you can be certain we'll
killfile him too.

/-- Joona Palaste (pa*****@cc.hel sinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"Insanity is to be shared."
- Tailgunner
Nov 13 '05 #152
Roose <no****@nospam. nospam> scribbled the following:
"Richard Heathfield" <do******@addre ss.co.uk.invali d> wrote in message
news:bo******** **@titan.btinte rnet.com...
Roose wrote:
>> > Just answer the questions.
>> You appear to be a very bright light, a couple of pairs of manacles, a
>> bloodstained wooden chair, a rope, a soundproof room, a rubber hose, a
>> piece of lead piping, an electric shock device, and a whole bucketful of >> broken teeth short of a torture chamber. Until you get those deficiencies >> sorted out, I'll answer the questions /I/ choose to answer.
> Are you suggesting that I've tortured you?
No. Learn To Read (tm).

Just engaging in some light wordplay, children's games if you will. You're
familiar with those. Remember that other thread?

This appears to be Roose's mantra for arguments he can't counter.

Stop quoting people's signatures, Roose.

/-- Joona Palaste (pa*****@cc.hel sinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"Immanuel Kant but Genghis Khan."
- The Official Graffitist's Handbook
Nov 13 '05 #153
JQuest <xe**@quest.net > scribbled the following:
On Tue, 4 Nov 2003, Richard Heathfield wrote:
void PrintObjectRepr esentation(FILE *fp, void *p, size_t len)
unsigned char *objrep = p;
printf(fp, " %X", *objrep++); <============== ===== ?!
putc('\n', fp);
Is that a typo? I don't get this printf.

Neither do I. Methinks it should be fprintf.

/-- Joona Palaste (pa*****@cc.hel sinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"When a man talks dirty to a woman, that's sexual harassment. When a woman talks
dirty to a man, that's 14.99 per minute + local telephone charges!"
- Ruben Stiller
Nov 13 '05 #154
Roose wrote:

Let me just chip in what I see is going on here.

Are you suggesting that I've tortured you? I didn't realize that forcing
all your inadequacies and defects of personality into the light -- oh god
the light -- would be so painful. So I understand the reluctance to answer
simple, straightforward questions.

The only one in pain here as I can see is Roose. And the
sheer terror he displays shines like a beacon is flooding
the place.

Just get over your fear of pain and just admit you are wrong.
This is just pathetic. I've seen people like you before, in the
end all you can think about is debunking your adversaries, and
when you can't you totally break down.

Why is it so bloody hard to point your newsreader to a different
newsgroup if you want to discuss matters outside the scope of
this newsgroup? Is it because you need your holy crusade to fill
your life with some meaning? If not, then _what_ is the problem
with discussing ISO C here and platform specific stuff elsewhere?

I am just asking because your behaviour is so totally beyond any
comprehensible reason.

Good bye.


Nov 13 '05 #155
In article <f%************ *****@newsread4 .news.pas.earth link.net>,
zz****@xxx.yyy says...
On Tue, 4 Nov 2003 01:18:34 -0600, Randy Howard <ra**********@F OOmegapathdslBA R.net> wrote:

In article <%Q************ *******@newssvr 21.news.prodigy .com>,
no****@nospam.n ospam 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.

Why? A large number of his posts seem to contain complaints about how
others answer questions here. IOW, he's acting like a moderator, albeit
not a very diplomatic one.
You could just as well paint Richard with the same brush.
I can't remember Richard doing much complaining about *how* people respond
to questions. When he finds fault, it is almost always on a technical
point, rather than a "religious" one.
This is transparent character assassination.
Actually, I am more and more convinced you are a transparent sockpuppet
for Roose.
Do you think we are stupid?

Please define "we".

Randy Howard _o
2reply remove FOOBAR \<,
_______________ _______()/ ()_____________ _______________ _______________ ___
SCO Spam-magnet: po********@sco. com
Nov 13 '05 #156
"Roose" <no****@nospam. nospam> wrote:
"Keith Thompson" <ks*@cts.com> wrote in message
news:lz******** ****@cts.com...
Testing can only demonstrate the presence of bugs; it can't prove
their absence. There are plenty of bugs that only appear under
unusual circumstances. Pointer bugs can easily cause sporadic
failures that might be missed by testing. Imagine a bug that only
shows up when an airplane does a 10 degree left bank between 28,000
and 30,000 feet during a daylight saving time transition in a location
where true and magnetic north differ by 2 degrees. (That scenario is
purely a product of my imagination).

Can you explain how an error in not writing standard C might result in such
a bug?

_That_ exact bug? No, obviously not, since Keith already said that that
scenario was a spur-of-the-moment invention. However, some bugs can be
pretty arcane, and only show up under unusual circumstances. For
example, search the Jargon File for "phase of the moon".

For an example where assuming that "integer" is equivalent to "pointer"
leads to a bug, assume that a pointer is six bytes and the best
available integer four.
Suppose, also, that for normal users, including developers, their
address space is in the lower part of the spectrum, so that they'll
never encounter the situation where a pointer converted to an integer
overflows, which means that for them, converting a (small) pointer to an
integer and back again apparently works.
Now suppose that your manager, who never uses the program but wants to
demonstrate it to a customer, happens to have a wheel bit set, causing
his address space to be in the upper reaches of memory, which means that
in his case the higher-order bytes of his pointers are _not_ all zero,
unlike the usual case...

Nov 13 '05 #157
On Tue, 04 Nov 2003 00:29:09 GMT
Alan Connor <zz****@xxx.yyy > wrote:
On Mon, 03 Nov 2003 20:55:22 GMT, Lew Pitcher <Le*********@td .com>

On Mon, 03 Nov 2003 20:39:38 GMT, Alan Connor <zz****@xxx.yyy >
What's a "register (qualified) object"?

register int SomeThing;

as opposed to

int SomeThingElse;

int *PointerToSomet hing;

you can
PointerToSometh ing = &SomeThingEl se;
but not
PointerToSometh ing = &SomeThing;
because SomeThing is a register qualified object, but SomeThingElse
is not.

Thanks. Dont' get it.

The register qualifier is a suggestion to the compiler that it stores
the object in a register rather than in memory. Since registers are
generally not memory mapped the C language makes the compilers job
easier by preventing you from attempting to take the address of a
register qualified object.
Mark Gordon
Paid to be a Geek & a Senior Software Developer
Although my email address says spamtrap, it is real and I read it.
Nov 13 '05 #158
On Tue, 04 Nov 2003 04:18:29 GMT
"Roose" <no****@nospam. nospam> wrote:
So, can anyone explain to me why everyone is so insistent on not
top-posting, when they don't care about the long sigs?

I mean, an explanation other than hypocrisy.


The 4 line rule is to prevent excessive use of band width in the days of
slow modems and also so that you did not have to page through a lot of
stuff after the main part of the message. In these days when most people
have at least a 33K connection (some cannot get more in the UK due to
limitations in the phone system) the band width is no longer such a big
issue so many people don't worry about an extra few lines if it does not
get out of hand. Others (including some here) still complain about sigs
longer than 4 lines, and they are within there rights to do so.

Top posting, on the other hand, makes it a real pain for everyone even
if a message has been snipped. 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 then go back to
the top (I have so much else on the screen at the moment that there is
only space for half a dozen lines of the message to be displayed). So
ALL the arguments against top posting are still valid.
Mark Gordon
Paid to be a Geek & a Senior Software Developer
Although my email address says spamtrap, it is real and I read it.
Nov 13 '05 #159
On Tue, 04 Nov 2003 07:49:07 GMT
"Roose" <no****@nospam. nospam> wrote:
After reading the first 1/3 carefully, it seems to me that a pointer

much like a symlink.

Uh, I'm not exactly sure what a symlink is, but if it is anything like
a Windows shortcut, there is definitely an analogy there.

The windows shortcut just stores the location of a file. A "pointer"
to it. An address. The address is the _path name_. In C, the
"address" is basically an integer, indicating where in a huge array of
memory the variable is.

You can have as many shortcuts as you want that point to the file. A
shortcut takes a small amount of storage, but not as much as a
(typical) file. You can have whole directories of shortcuts that
point to files all over the place, in order to organize them.
Likewise, you can have collections of pointers, that point to various
different things _scattered_ all over memory.


On many platforms a pointer is basically *NOT* an integer. To provide
one concrete example, on the X86 in some of its modes (I'm not up to
date on all of its memory models) a pointer is a PAIR of integers with
more that one way of representing every location. Also, thinking of them
as integers can lead to alignment problems and various other nastiness.

The symlink (or shortcut) analogies are better in many ways since they
do not introduce a lot of this confusion. However, IMHO a symlink or
shortcut is most like a void* pointer since it can point to any type of
object, if you treat the object it points to as the wrong type (such as
treating a spreadsheet as a text document) you hit all sorts of
problems, and you can't do arithmetic on it.

However, if you have a pointer to a specific type (say integer) you can
also do things like ask for the pointer to the next integer, although
this only works if the integers are in a block because you are either
pointing to an array of integers or a block of allocated memory you are
using to store integers in.
Mark Gordon
Paid to be a Geek & a Senior Software Developer
Although my email address says spamtrap, it is real and I read it.
Nov 13 '05 #160

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.