Understanding pointers in c book

Uploaded on 

 

Media, Inc. Understanding and Using C Pointers, the image of a piping crow, . of C. If you are a more experienced C or C++ programmer, this book will help. Improve your programming through a solid understanding of C pointers and memory management. With this practical book, you'll learn how pointers provide the. download Understanding and Using C Pointers 1 by Richard M. Reese (ISBN: ) from site's Book Store. Everyday low prices and free delivery on.

Author:PENNY STCROIX
Language:English, Spanish, Arabic
Country:United States
Genre:Children & Youth
Pages:224
Published (Last):15.12.2015
ISBN:738-5-15201-640-2
Distribution:Free* [*Registration needed]
Uploaded by: CARROLL

53504 downloads 154369 Views 35.87MB ePub Size Report


Understanding Pointers In C Book

usaascvb.info - download Understanding Pointers in C book online at best prices in India on usaascvb.info Read Understanding Pointers in C book reviews & author details. He needs command over pointers to be able to exploit their immense potential. Pointers are all about power and punch and this book covers everything that has . Improve your programming through a solid understanding of C pointers and memory management. With this practical book, you'll learn how.

This book has become my white whale. Since I started reading debugging books, and especially now that I'm digging through older ones, I find bits of advice that simply don't work today. While some of it could be construed as useless or idiotic, I've always found the authors come from a position of earnestness, attempting to draw the best conclusions based on decent principles and what they knew at the time they wrote it. In some cases they may not have known much, but they're honestly and humbly trying to impart some wisdom. When Kernighan put up the following example, I saw what seemed to be the opposite of that.

Things were a bit different then. Enough about the material. I want to explore the question of how something so wrong even got written.

Why is this important? As I read the book and if you read my notes, you know where this is going I started to notice something in the wording and tone. The further I progressed the more I became convinced of it, and I think it explains how he managed to mangle the explanation of C pointers so badly. With BASIC, the key thing to know about most implementations at the time is that there were no functions and no scope aside from the global scope.

The control follows a stack principle, but no arguments are passed.

Pointers in C

GOSUB routines are a way to factor out common code, but that common code has to work on global variables. Now, consider the case of simple electronic devices. Even today some embedded devices, usually programmed using C, do not have a call stack that dynamically allocates space for automatic variables. The only stack you have is for return addresses and it is probably handled in hardware. Life is great.

Massacring C Pointers

This is the mindset I think Traister had and never got past. In the book there is one fleeting mention of the stack in reference to excessive automatic memory allocation. His writing about pointers suggests that he thinks, for each function, space is set aside to hold the local variables for the duration of the program, but you can only access them when inside the function in which they were declared. So pointers are really powerful because you can provide this address to another function and it can change the value using only a parameter.

Further evidence for his lack of understanding is that he frequently cites ridiculous space micro-optimizations within functions, such as avoiding the use of integers for index variables, if possible. Another one, mentioned often, is local char arrays that have a fixed size. There are good reasons to not use them but his are not among them.

His admonishment is that they waste space. Technically, that is true, but they don't exist until they're on the stack. And he never talks about global or file variables.

This interpretation runs into some problems once you start asking how functions with malloc will work, but it's worth pointing out that there is almost no discussion about memory management. In a book devoted to C pointers, that's a toxic mix of gross negligence and incompetence. He does this by passing an arbitrary number of arguments to a function the first being the number of arguments and accessing them using offsets from the address of the first argument.

Honestly, this is the most generous interpretation of the text I could come up with, and it still paints a terrible picture.

Occam's Razor suggests that Traister is just clueless. Given the ineptness of the book, you'd think it was self-published. You would be wrong. That programmer was right, but the publisher went ahead and published it anyway. Since there was a second edition, the assumption is that the book sold well.

The lack of material in this area at the time is probably why it sold. Why is this important?

As I read the book and if you read my notes, you know where this is going I started to notice something in the wording and tone. The further I progressed the more I became convinced of it, and I think it explains how he managed to mangle the explanation of C pointers so badly.

With BASIC, the key thing to know about most implementations at the time is that there were no functions and no scope aside from the global scope. The control follows a stack principle, but no arguments are passed. GOSUB routines are a way to factor out common code, but that common code has to work on global variables.

Now, consider the case of simple electronic devices. Even today some embedded devices, usually programmed using C, do not have a call stack that dynamically allocates space for automatic variables.

The only stack you have is for return addresses and it is probably handled in hardware. Life is great. This is the mindset I think Traister had and never got past. In the book there is one fleeting mention of the stack in reference to excessive automatic memory allocation.

His writing about pointers suggests that he thinks, for each function, space is set aside to hold the local variables for the duration of the program, but you can only access them when inside the function in which they were declared. So pointers are really powerful because you can provide this address to another function and it can change the value using only a parameter.

Further evidence for his lack of understanding is that he frequently cites ridiculous space micro-optimizations within functions, such as avoiding the use of integers for index variables, if possible. Another one, mentioned often, is local char arrays that have a fixed size. There are good reasons to not use them but his are not among them.

His admonishment is that they waste space. Technically, that is true, but they don't exist until they're on the stack.

Massacring C Pointers

And he never talks about global or file variables. This interpretation runs into some problems once you start asking how functions with malloc will work, but it's worth pointing out that there is almost no discussion about memory management.

In a book devoted to C pointers, that's a toxic mix of gross negligence and incompetence.

He does this by passing an arbitrary number of arguments to a function the first being the number of arguments and accessing them using offsets from the address of the first argument.

Honestly, this is the most generous interpretation of the text I could come up with, and it still paints a terrible picture. Occam's Razor suggests that Traister is just clueless. Given the ineptness of the book, you'd think it was self-published.

Massacring C Pointers

You would be wrong. That programmer was right, but the publisher went ahead and published it anyway.

Since there was a second edition, the assumption is that the book sold well. The lack of material in this area at the time is probably why it sold. I could not track down a review of this book anywhere and yes, I looked through scans of Byte Magazine et al. In other words, like many books—and tech books in particular—it sold because of its title and good timing. You start to wonder if this is actually the same person who writes all this.

Related articles:


Copyright © 2019 usaascvb.info.
DMCA |Contact Us