473,842 Members | 1,917 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
Keith Thompson <ks*@cts.com> wrote:
Irrwahn Grausewitz <ir*******@free net.de> writes:

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.


Does this refer to Richard or to me?


Err, damn, no, neither! I managed to forget to mention the name of the
individual in question: Alan Conor.
Did you ever abuse usenet in a manner that would make it worth to do a
google search? Can't imagine that. :)

Regards
--
Irrwahn
(ir*******@free net.de)
Nov 13 '05 #261
Richard Heathfield <do******@addre ss.co.uk.invali d> wrote:
Irrwahn Grausewitz wrote:
pete <pf*****@mindsp ring.com> wrote:

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


To dissolve this ambiguity one could differentiate between "pointer
variables" (which represent objects that can hold pointer values) and
"pointer values" which are ... err ... pointer values :)


Problem: an object that holds a pointer value need not be a variable. For
example:

int i = 6;
int * const p = &i; /* p is not a variable - or at least, to persuade anyone
that it is, you'd have to have kissed the Blarney. */


But it's not a 'real' constant either. Now, what is it? (rhetorical
question) After all it's an lvalue, yet, const qualified as it is, not
modifiable.

It appears to me that Ben Pfaff's suggestion (in reply to my post) is
the most useful and accurate one:

"objects of pointer type" or "pointer objects"

and

"values of pointer type" or "pointer values"

Regards
--
Irrwahn,
"I shall not post late at night." "I shall not post late at night."
"I shall not post late at night." "I shall not post late at night."
"I shall not post late at night." "I shall n...
Nov 13 '05 #262
On Wed, 05 Nov 2003 09:38:40 +0000, Joona I Palaste wrote:
Nils Petter Vaskinn <no@spam.for.me .invalid> scribbled the following:
On Tue, 04 Nov 2003 21:05:17 +0000, Joona I Palaste wrote:
You mean the time RJH told Dennis Ritchie he (DMR, not RJH) was off
topic? Yes, that really happened.

Is that archived somewhere? Google? Somewhere else?


Try this:
http://groups.google.com/groups?q=De....co.uk&rnum=26


Now that's classic. Thank you very much, made my day.

--
NPV

"the large print giveth, and the small print taketh away"
Tom Waits - Step right up

Nov 13 '05 #263
Sheldon Simms wrote:
Pointers can be valid or invalid.
A valid pointer has a value that points to
an existing object.
An invalid pointer has a value that does not point to an
existing object.


I like your essay.

There's also the matter of the "one past" pointer.

char variable = 0;
char other;

(&variable + 1); /* defined */
(&variable + 1 > &variable); /* defined, true */
(&variable + 1 != &other) /* defined */
*(&variable + 1); /* undefined, regardless
** if (&variable + 1 == &other)
*/

--
pete
Nov 13 '05 #264
In <bo**********@e lf.eng.bsdi.com > Chris Torek <no****@elf.eng .bsdi.com> writes:
Well, 25 years ago was 1987, which predates ANSI C, but mainly I

^^^^^^^^^^^^^^^ ^^^^^^
Was it? Then, we must be in 2012 right now ;-)

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 13 '05 #265
Mark McIntyre <ma**********@s pamcop.net> wrote in message news:<hp******* *************** **********@4ax. com>...
On Tue, 4 Nov 2003 06:28:29 +0000 (UTC), in comp.lang.c , Richard
Heathfield <do******@addre ss.co.uk.invali d> wrote:
Sheldon Simms wrote:
Ok, let me try to tell you something about pointers that is (hopefully)
precisely correct, but won't confuse you.

A pointer is a kind of variable that can "point to" some object.
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?


iirc, yes.

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"?
:-)


<grin>
or even more convoluted, how about
"a pointer is an /object/ whose legal values can only be /addresses/
of other objects" ?

goose,
is there no textbook (c-std) definition ?
Nov 13 '05 #266
goose wrote:

Mark McIntyre <ma**********@s pamcop.net> wrote in message news:<hp******* *************** **********@4ax. com>...
On Tue, 4 Nov 2003 06:28:29 +0000 (UTC), in comp.lang.c , Richard
Heathfield <do******@addre ss.co.uk.invali d> wrote:
Sheldon Simms wrote:

> Ok, let me try to tell you something about pointers that is (hopefully)
> precisely correct, but won't confuse you.
>
> A pointer is a kind of variable that can "point to" some object.

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?


iirc, yes.

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"?
:-)


<grin>
or even more convoluted, how about
"a pointer is an /object/ whose legal values can only be /addresses/
of other objects" ?


The null pointer constant, mentioned above,
is a defined value for pointers, but is not an address.
The "one past" pointer, also has a legal value,
but does not point to an object.

--
pete
Nov 13 '05 #267
ru**@webmail.co .za (goose) wrote:
Mark McIntyre <ma**********@s pamcop.net> wrote in message news:<hp******* *************** **********@4ax. com>...

And are functions objects?


iirc, yes.


IIRC, no.

ISO/IEC 9899:TC1
3.14 object
region of data storage in the execution environment, the contents of
which can represent values. [...]

Functions, in this context, have no contents that can represent values.
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"?
:-)


<grin>
or even more convoluted, how about
"a pointer is an /object/ whose legal values can only be /addresses/
of other objects" ?


I'd rather say that pointer objects can hold pointer values. It
seems the terminus "pointer" is (IMHO unfortunaltely) often used
as a synonym for "pointer object" or "pointer value" respectively,
depending on context.

(Thanks, Ben Pfaff.)

Regards
--
Irrwahn
(ir*******@free net.de)
Nov 13 '05 #268
On Wed, 05 Nov 2003 14:30:33 +0000, pete wrote:
goose wrote:

Mark McIntyre <ma**********@s pamcop.net> wrote in message news:<hp******* *************** **********@4ax. com>...
> On Tue, 4 Nov 2003 06:28:29 +0000 (UTC), in comp.lang.c , Richard
> Heathfield <do******@addre ss.co.uk.invali d> wrote:
>
> >Sheldon Simms wrote:
> >
> >> Ok, let me try to tell you something about pointers that is (hopefully)
> >> precisely correct, but won't confuse you.
> >>
> >> A pointer is a kind of variable that can "point to" some object.
> >
> >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?


iirc, yes.
>
> 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"?
> :-)
>


<grin>
or even more convoluted, how about
"a pointer is an /object/ whose legal values can only be /addresses/
of other objects" ?


The null pointer constant, mentioned above,
is a defined value for pointers, but is not an address.
The "one past" pointer, also has a legal value,
but does not point to an object.


A null pointer constant is not a pointer at all. It first becomes a
(null) pointer after conversion to a pointer type.

-Sheldon

Nov 13 '05 #269
On Wed, 05 Nov 2003 05:59:32 +0000, Richard Heathfield wrote:
Keith Thompson wrote:
Sheldon Simms <sh**********@y ahoo.com> writes:

[...]
In any case, I would call p a variable - a const variable. If you're
speaking English, it's a contradiction, but we're speaking jargon.


Hmm. Since the C standard doesn't define the term "variable", I'd
prefer to use it in its normal English sense, which would exclude
objects whose value cannot be modified.


That is precisely how I use it. I'm aware of this strange idea of "const
variable". I think it's easier and more useful to talk about objects.


The word variable comes to programming from mathematics, where it
is also possible to have a variable with a constant value.

Also, I think there is an important difference between the concepts
of "variable" and "object". A variable is a named, typed, object. An
object is, by itself, only storage. It can store a value, but doesn't
have any inherent type or name.

-Sheldon

Nov 13 '05 #270

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.