473,889 Members | 1,386 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 22005
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.pow ernet.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******@addre ss.co.uk.invali d> 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.c om/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******@addre ss.co.uk.invali d> 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.c om/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************ ********@comcas t.com>,
James Hu <jx*@despammed. com> wrote:
On 2003-11-07, Christian Bau <ch***********@ cbau.freeserve. co.uk> wrote:
In article <bo**********@e lf.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.hel sinki.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.c om/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.c om/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.pow ernet.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******@addre ss.co.uk.invali d> 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.c om/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.yy y> 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 "technicall y correct" English; but since when was rock & roll "technicall y 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

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.