"Mastering C Pointers"....

R

Richard Heathfield

Keith Thompson wrote:

Something I forgot to mention before: One if the first things that
breaks down if you carry the "pointers are like symlinks" analogy too
far is that pointers, unlike symlinks, are typed. An object of type
"int*" can only point to an int.

Betraying my ignorance of all things Unixy here, but is not a symlink only
capable of pointing to an inode? Could it not, therefore, be said to be
"typed" at some level?
 
D

Dave Vandervies

Keith Thompson wrote:



Betraying my ignorance of all things Unixy here, but is not a symlink only
capable of pointing to an inode? Could it not, therefore, be said to be
"typed" at some level?

In some ways, but that's not terribly helpful.

ObC: It's a lot like saying that a void pointer is only capable of
pointing to a bunch of bytes and not, say, the stuffed penguin on my desk.


dave
 
A

Alan Connor

No, but if they recognise you in an interview for a job your posts here
would be held against you. Equally some of mine where I have made
mistakes could be held against me, but I would like to think that I've
not posted anything as bad as some of your advice.

Yes. Your posts could well be held against you.

So those people here who have engaged in concerted character assassination
may well find prospective employers looking at their posts and asking
themselves:

Do I want a viscious, dishonest, and hateful person like that working here?

And Roose could certainly make sure that anyone he is applying to saw
a sampling of those posts, which could well cause the interviewer to ignore
any legitimate criticisms on the part of the posters.....

Like the boy who cried "wolf" too often.
 
A

Alan Connor

Alan, I believe you're making a mistake. As a relative newcomer to
this newsgroup, I can certainly understand you not being interested in
some of the recent discussions about topicality and netiquette. Such
things are an unfortunate side effect of having such a free-wheeling
community with no central control.

Thank goodness there is no central control. Freedom from authoritarian
bigots is one the best things about Usenet.

Roose is, I believe, being deliberately disruptive.

I think that you are lying there. A person stupid enough to believe that
would not be capable of operating a computer.



Richard and
others (including myself to some extent) have been criticizing him for
his behavior and correcting his misstatements.

If only you stopped there, which you obviously don't. Another lie.

Richard in particular
has been an extremely valuable and valued contributor to this
newsgroup for many years, because of his technical expertise, his
willingness to share it with others, and his willingness to learn from
others. If you choose to pay attention to Roose and ignore Richard,
the loss will be yours.

That's my advice. Take it or leave it.

I think for myself, Keith.

And I think you are a liar, and am sick of this continued smear campaign
against Roose.
 
T

Tim Woodall

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.
Not exactly your scenario but I've seen 15 year old code break because
malloc was cast and stdlib.h wasn't included. New 64 bit machine with
32 bit ints and 64 bit pointers ....

Interestingly, this was the second machine with this pointer/int size
mismatch that the code was ported to but the first one to see (repeatable)
crashes.

Tim.
 
K

Keith Thompson

Richard Heathfield said:
Keith Thompson wrote:


Betraying my ignorance of all things Unixy here, but is not a symlink only
capable of pointing to an inode? Could it not, therefore, be said to be
"typed" at some level?

A symlink doesn't point directly to an inode; it refers to a file
name. That's what distinguishes a symlink (*symbolic* link) from a
hard link. On the file system implementation level, a symlink is just
a plain text file containing the name of its target, with a type
attribute that says it's a symlink. If you remove the target file,
the symlink is still there, pointing to nothing; recreate the target
file and the symlink is valid again.

The loose analogy with pointers is: files are objects, file names are
their addresses, and symlinks are pointer objects. The analogy
rapidly breaks down if you go much beyond this.

A hard link points to an inode; in fact, all files are implemented as
hard links. Symlinks can cross fileystem boundaries; hard links
can't.

The implementation details and terminology are probably incorrect in
some ways, but I believe they convey the general idea.
 
A

Alan Connor

What I would like to see is one un-corrected, in-context statement by Roose
that if accepted by a novice as the whole picture for a *while* would result
in them being unable to ever program effectively in C.

Because *that* is what so many people are accusing him of, and I think that
this is an outrageous and malicious exaggeration, at BEST.
 
M

Mark McIntyre

That's it.

You'd be VERY well advised to forget this idea, if you intend to
actually learn C for commercial purposes. In many systems, including
x86, a pointer is most definitely NOT an integer. It may be two
integers for instance. Or Something Else Entirely.
The fact that a bunch of obvious jerks don't like you is an extremely
good recommendation in my book, Roose.

*sigh*.
People have no particular opinion of roose, what people object to are
the errors, falsehoods and omissions in the posts coming from roose.

Don't mistake exasperation with someone's intransigence for something
else.

And don't assume that the mickey-mouse answer is right just because
you find it easier to grok. Truth is often harder to learn.
 
M

Mark McIntyre

I think that you are lying there. A person stupid enough to believe that
would not be capable of operating a computer.

If only you stopped there, which you obviously don't. Another lie.

Okay, enough. You're either a total idiot, or you're a troll.

Only one or the other would call Keith Thompson AND Richard Heathfield
liars within a single post. For our amusement as much as your own
enlightenment, you might want to google for the history of their
posts, and do a quick author search on Amazon, and then reflect on
just how stupid you now look.
I think for myself, Keith.

And I think you are a liar, and am sick of this continued smear campaign
against Roose.

You /are/ roose. I claim my five pounds.

*plonk*
 
M

Mark McIntyre

This isn't precisely correct. Sorry to dash your hopes.

A pointer need not be variable. For example, there exists such a thing as a
null pointer constant.

And of course a null pointer is a pointer that doesn't point to
anythin....

And are functions objects?

So can we settle on "a pointer is an object that can probably point to
another object, or possibly to a function, which is possibly not an
object, ouch my head hurts"?
:)
 
M

Mark McIntyre

You mean the time RJH told Dennis Ritchie he (DMR, not RJH) was off
topic? Yes, that really happened.
Reply written primarily to let Roose and/or Connor know what the irony
was. With any luck at least one of them has not killfiled me yet.

Just in case you're in their bitbuckets already, I'm replying to your
post too. Its too good to lose...
 
M

Mark McIntyre

So, can anyone explain to me why everyone is so insistent on not
top-posting,

please don't top post in CLC
when they don't care about the long sigs?

We care, and several people have trimmed their sigs on request. But
unlike top=posting, long sigs don't screw up the sense of posts except
when responders have defective newsreaders.
I mean, an explanation other than hypocrisy.

I'm surprised you can write that word.

I mean, without your nose hitting the keyboard and sprouting leaves
and a birds nest.
 
M

Mark McIntyre

but some
people are stuck with their news service and it seems unfair to
discriminate against such people by going on and on about something that is
outside their power to change.

Indeed, and FWIW I was in fact not aware of my services' added
garbage till recently - I don't read my own posts for obvious reasons.
 
M

Mark McIntyre

It's completely transparent. If I were a troll, then you just let common
sense run its course.

Which is to correct your errors, tell you you're wrong and generally
make life awkward for you till you either crawl back under your rock,
or mend your ways.
It's because you think I actually something valuable
to say, that competes with your jack-off C standard knowledge, that you must
repeatedly, vehemently insist that I'm a troll.

Nope. Its because you make inflamatory and blatantly incorrect
statements that you get called a troll.
And, to which I would respond, as in the previous thread -- if I'm a troll,
then follow your own netiquette and killfile me.

I'm not going to afford you that pleasure, I fully intend, a I suspect
do others, to continue correcting your errors.
I don't care to be
responded to by people who don't think that I have something valuable to
say.

When you have something valuable to say I'll be silent. I mean it.
 
K

Keith Thompson

Alan Connor said:
I think for myself, Keith.

And I think you are a liar, and am sick of this continued smear campaign
against Roose.

Mr. Connor, you are a fool. I freely admit that any statement I make
might be mistaken, but I have not deliberately lied in this thread or
any other, and I deeply resent the accusation. I was honestly trying
to offer you the benefit of my experience, and this is how you respond.

If I used a killfile, you would now be in it. If I see you posting
misinformation, I may or may not post a correction for the benefit of
others. I will not make any further attempts to help you; others will
do as they wish.

(If you wish to apologize, I will consider disregarding your
accusation and moving on.)
 
M

Mark McIntyre

And I didn't say (or didn't mean to say), that it _is_ an integer,

Really? How about this quote:
next...

Any program, of critical nature or not, is tested, and
these types of errors don't even take testers to figure out. The code
simply won't work when you try it for the first time.

This is the classic "it can't happen" mistake that programmers make.
"Oh, if that were invalid, testing would have proved it".

Wrong. Imagine you have 48 bit pointers, but only 32 bit integers. Now
imagine that during testing your app is the only one running on the
box. So all the pointers point to the bottom 4GB.

And now you move to prod, where there's a big database on the same box
using the bottom 4GB of memory, and your app is in the >4GB zone....
 
M

Mark McIntyre

Well, I thought that too, at first, but I now think it is unlikely, as a
little traffic analysis will show.

I'm happy to be shown to be wrong, tho it won't save Alan from my
killfile,
Firstly, Alan Connor first posted to this newsgroup in early October of this
year, well before Roose,

Of course, Roose could be Alan's alter ego. Rather than the other way
round. Frankly I can't be arrissed to work it out. One's a troll, the
other's defending a troll. *sigh*
 
M

Mark McIntyre

You could use news.individual.net (formerly news.cis.dfn.de) for text
groups.

Thanks for the tip. What I mostly use alibis for us binaries however.

ntl aren't too bad for text, except that somehow they screwed up CLC
some months back so that the last-read message Id is set to something
absurd like ninety five trillion, and Agent won't download anything.
Argh.
 
P

pete

Mark said:
And of course a null pointer is a pointer that doesn't point to
anythin....

And are functions objects?
No.

So can we settle on "a pointer is an object that can probably point to
another object, or possibly to a function, which is possibly not an
object, ouch my head hurts"?

A pointer doesn't have to be an object.
A pointer could also be the address of an object.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,813
Messages
2,569,696
Members
45,479
Latest member
QFZErin313

Latest Threads

Top