C Traps and Pitfalls
Andrew Koenig
- 出版商: Addison Wesley
- 出版日期: 1989-01-11
- 售價: $1,840
- 貴賓價: 9.5 折 $1,748
- 語言: 英文
- 頁數: 160
- 裝訂: Paperback
- ISBN: 0201179288
- ISBN-13: 9780201179286
-
相關分類:
C 程式語言
已絕版
買這商品的人也買了...
-
$1,170$1,112 -
$600$588 -
$590$466 -
$980$960 -
$290$229 -
$780$616 -
$990$782 -
$2,500$2,375 -
$480$408 -
$820$697 -
$680$646 -
$880$695 -
$1,127Database System Concepts, 5/e (IE) (美國版ISBN:0072958863)
-
$540$427 -
$390$332 -
$650$507 -
$680$578 -
$550$468 -
$680$666 -
$600$540 -
$1,100$1,078 -
$299$254 -
$880$616 -
$1,200$1,020 -
$520$442
相關主題
商品描述
Description:
Even C experts come across problems that require days ofdebugging to fix. This book helps to prevent such problems byshowing how C programmers get themselves into trouble. Each ofthe book's many examples has trapped a professional programmer.
In addition to its examples, C Traps and Pitfalls offers adviceon:
- avoiding off-by-one errors
- understanding and constructing function declarations
- understanding the subtle relationship between pointers andarrays
Distilled from the author's experience over a decade ofprogramming in C, this book is an ideal resource for anyone,novice or expert, who has ever written a C program.
Table of Contents:
Introduction.
1. Lexical Pitfalls.
= is not ==
& and | are not && or ||
Greedy lexical analysis.
Integer constants.
Strings and characters.
2. Syntactic pitfalls.
Understanding function declarations.
Operators don't always have the precedence you want.
Watch those semicolons!
The switch statement.
Calling functions.
The dangling else problem.
3. Semantic pitfalls.
Pointers and arrays.
Pointers are not arrays.
Array declarations as parameters.
Eschew synecdoche.
Null pointers are not null strings.
Counting and asymmetric bounds.
Order of evaluation.
The &&, ||, and ! operators.
Integer overflow.
Returning a value from main.
4. Linkage.
What is a linker?
Declarations vs. definitions.
Name conflicts and the static modifier.
Arguments, parameters, and return values.
Checking external types.
Header files.
5. Library functions.
Getchar returns an integer.
Updating a sequential file.
Buffered output and memory allocation.
Using errno for error detection.
The signal function.
6. The preprocessor.
Spaces matter in macro definitions.
Macros are not functions.
Macros are not statements.
Macros are not type definitions.
7. Portability pitfalls.
Coping with change.
What's in a name?
How big is an integer?
Are characters signed or unsigned?
Shift operators.
Memory location zero.
How does division truncate?
How big is a random number?
Case conversion.
Free first, then reallocate?
An example of portability problems.
8. Advice and answers.
Advice.
Answers.
Appendix: printf, varargs, and stdarg.
The printf family.
Simple format types.
Modifiers.
Flags.
Variable field width and precision.
Neologisms.
Anachronisms.
Variable argument lists with varargs.h.
Implementing varargs.h.