A
- #if...#endif facilities, 61
- * dereferencing operator, 39
- omissions of, 39-40
- reducing use of, 47
- ++ and -- operators, 50
- array subscripts and, 59
- in assignments, 56
- side effects of, 59
- Ada language, 1, 2
- comments and, 18
- Addresses, 39-40
- argument, 10-11
- changing, in pointer variable, 41-42
- allocate macro, 46
- code for, 47
- AND operator, 8
- Arguments. See specific types of arguments
- Array notation, 41-42, 63
- compared to pointer/dereferencing notation, 42
- multidimensional arrays and, 65
- Arrays, 21
- declaring, 22
- multidimensional, 65
- rules for using, 21-23
- starting, 21
- See also Array notation
- Array subscripts, 54
- ++/-- operations within, 59
- using [] and, 65
- Assignments, 7
- ++/-- operators in, 56
- functions, implementing, 76
- in if statement, 8
- levels of indirection in, 43
- of one string variable to another, 24
- pointers and, 43
- as separate statements, 10, 14
- within return statement, 13
- Awk language, 84
B
- Braces, 15-16
- conditional statements and, 14, 15, 60
- in macro definitions, 60-61
C
- C++ language, 1, 4
- advantages, 71-73
- classes, 73-76, 77
- coding suggestions, 78
- comments, 69-70
- compiler, 85
- const variables and, 70
- defined, 69
- development, 79-88
- disadvantages, 73-77
- explained, 4
- in-line functions, 71
- macros and, 72
- objects, 74, 77
- output parameters and, 2
- parenthesis in, 73
- standards, 80-84
- "streams" I/O package, 72
- strings and, 25, 27
- templates, 71-72
- training in, 84
- working with, 69-78
- See also C language
- C++ Programming Style, 73
- Case-sensitivity, 66
- cat function, 51-52
- code for, 51
- defined, 51
- successful call of, 52
- unsuccessful call of, 52
- See also Functions
- char variable, 61
- coding suggestions, 67
- default, type, 61
- rule for using, 62
- signed, 61
- unsigned, 61
- See also Variable declarations
- C language
- alternative to other languages, 1
- assembly language and, 2-3
- basic problem with, 1-3
- condensed coding style and, 3
- conquering, 4-5
- development, 79-88
- machine-level programming and, 10
- programming attitude of, 5
- programming with, 3
- sequence of operations, 3
- source/executable libraries, 5
- speed and, 54-56
- standards, 80-84
- training in, 84
- uses for, 1
- See also C++ language
- Classes, 73-76, 77
- creating, 74, 80
- definitions of, 74
- OutQ, 73-75
- reusing, 80
- string, 75-76
- C library functions, 62
- errno variable, 64-65
- See also Functions
- Code analyzers, 85
- CodeCheck, 85
- Code reuse, 87
- Coding
- alternative, styles, 83
- changing standards and, 83-84
- discipline, 80
- loops, 21
- quick, 14
- Coding suggestions, 12
- array and string, 27
- C++, 78
- char variable, 67
- macro, 67
- pointers, 53
- syntax, 19
- variable declaration, 37
- See also Coding
- Comments
- C++ and, 69-70
- delimiting, 18
- macro definitions and, 69-70
- runaway, 18
- sample code for, 18
- syntax for, 17-20
- Components, reusable, 87
- principles of, 87-88
- Constants
- const variables and, 70
- integer, 70
- octal, 10
- const variables, 70
- See also Variable declarations
- C pointers, 1
- at application level, 2
- See also Pointers
D
- Dangling pointers, 44
- creating, 44
- See also Pointers
- Debuggers, 85
- Declarations, 29
- examples of, 29-30
- external, 31-32
- between functions, 33-34
- making, 35
- primary rule for, 33
- See also Variable declarations; Visibility
- Dereferenced pointer parameters, 40
- local variables and, 41
- notation, 42
- post-increments and, 50
- when to use, 40-41
E
- Eiffel language, 12
- else clauses, 15-16
- errno variable, 64
- using, 65
- See also Variable declarations
- Errors, typo, 13
- Export variables, 33
- defining, 33
- See also Variable declarations
- extern keyword, 30, 32
F
- Function arguments, 58
- declaring, as const, 63
- passing, 62-63
- Function parameters, 2
- Function prototypes, 62
- for C library functions, 62
- header files and, 62
- Functions
- addresses for, 10-11
- assignment, implementing, 76
- cat, 51-52
- C library, 62
- errno variable, 64-65
- coupled, 34
- declaring, 35
- static, 30
- EXPORT, 35
- free(), 72
- in-line, 71
- malloc(), 72
- member, 71
- revised, 77
- month_name, 46
- new_string, 45
- outq_entry, 73, 74
- parenthesis in, 64
- returning two values, 40
- scanf, address for, 10-11
- SHARE, 35
- strcpymax, 58
- strupr, 54, 55
- system, 73
- upper_case, 54-55
- visibility classes and, 33
H
- Header files, 62
- High-level language (HLL), 40
I
- Identifiers, 66
- global, 66
- if statements, 7
- assignment in, 8
- else clause matching and, 15-16
- expressions within parenthesis, 9
- logical expressions in, 9
- non-zero value of, 9
- In/out parameters, 41
- local variables with, 42
- Integers, 61-62
- constants, 70
- decimal, 10
- unsigned, 62
- int variable, 62
- See also Variable declarations
L
- Linkage, 30
- internal, 32
- Lint filters, 7-8
- Local variables, 33
- dereferenced parameters and, 41
- with in/out parameters, 42
- using, 33
- when to use, 40-41
- See also Variable declarations
- Logical expressions, 9
- Loops, 21
- errors and, 22
- for, 22
- while, 51-52
M
- Macro arguments, 59
- evaluating, 60
- Macros
- address_of, 48
- using, 49
- allocate, 46, 47
- and/AND, 8
- C++ and, 72
- conditional logic and, 60
- contents_of, 48
- C++ and, 72
- using, 49, 50
- cpystr, 25
- cube, 57-58
- defining, 60
- definitions of, 57-58
- braces and, 60-61
- double, 57-58
- improving, 60
- ELSE, 16
- ELSEIF, 16
- coding with, 17
- ENDIF, 16
- EQ, 8
- EXPORT, 35-36
- GLOBAL, 37
- IF, 16
- IMPORT, 34, 36
- or/OR, 8
- OVER_TABLE, 23
- parenthesis in, 58
- pitfalls of, 57-61
- avoiding, 58
- pointer-related, 48
- PTR, 48
- C++ and, 72
- using, 49
- ptrace, 61
- REF, 72
- for safe strings, 25
- using, 26
- SEMIGLOBAL, 37
- SHARE, 34, 35
- size of operator and, 24-25
- standard, 81
- STRING, 25
- STRING_TABLE, 25
- strmaxlen, 25
- TABLE, 22
- table definition, 22-23
- table loop, 23
- THEN, 16
- malloc operation, 46
- Memory allocation, 46
- Memory leakage, 46
- avoiding, 48
- reasons for, 47
- Memory management, automated, 75-76
- Mistakes, common, 7-12
- if statements and, 7-8
- month_name function, 46
N
- Nested blocks, 33
- new_string function, 45
- NULL pointers, 43-44
- allocate and, 46
- alternatives to, 43-44
- checking for, 44
- reallocate with, 46
- See also Pointers
O
- Object data, 74
- Object-oriented programming (OOP), 4
- applying, techniques, 75
- concepts, 4
- features, 69
- learning, facilities, 84
- Operations
- char variable and, 62
- decrement, 59
- embedding, 59
- increment, 59
- order-dependent, 65
- post increment, 3
- sequence of, 3, 65-66
- Operators
- (-), 76
- bitwise, 8
- delete, 72
- logical, 8, 9
- new, 72
- OR, 8
- overloading, 76
- precedence levels, 10
- sizeof, 24
- OutQ class, 73-74
- definition of, 74
- revised, 75
- See also Classes
P
- Parenthesis
- after function invocations, 64
- C++ and, 73
- if statements and, 9
- in macros, 58
- in order-dependent operations, 65-66
- return statement expressions and, 14
- using, 10
- Pascal language, 1, 2
- as foundation to C, 84
- Pointers, 1, 39-56
- * operator and, 39
- address, 2
- at application level, 2
- array notation and, 41
- in assignment statements, 43
- changing addresses in, 41-42
- dangling, 44
- dereferenced, parameters, 40
- handle, 2
- initializing, in their definitions, 46-47
- macros related to, 48
- notation, 42, 63
- null, 43-44
- ways of implementing, 2
- Pointer variables
- automatic, 47
- static, 47
- See also Pointers; Variable declarations
- "Pretty printers," 85
- Programming editors, 83-84, 85
- PVCS Version Manager, 86
R
- References, 40, 63
- C++, 72
- return statements
- coding, 15
- parenthesis and, 14
- Return values
- after malloc, 46
- negative/zero, 9-10
- Reuse, coding, 87
- principles of, 87-88
S
- Sample code
- array of part numbers, 11
- for comments, 18
- See also Coding; Coding suggestions
- Scope, 30
- defined, 30
- Semicolon, missing, 13-14
- Share variables, 33
- defining, 33
- using, 33
- See also Variable declarations
- Signals, 66
- Software configuration management (SCM), 86
- tools, 86
- Source-code checkers, 7-8
- Standards, programming, 80-84
- approaching, 81
- company, 80-81
- discipline in, 80
- evolution of, 83-84
- getting started with, 81-83
- indenting example, 81
- instituting, 82-83
- for lexical style, 80
- suggested list of, 81-82
- symbol use and, 82-83
- Statements
- conditional
- braces and, 14, 15, 60
- curly brackets around, 14
- subordinate, adding/deleting, 15-16
- syntax for, 13-20
- See also specific statements
- static keyword, 30, 32
- initialization and, 32
- Streams, 72
- Strings, 24
- assignments, 24
- classes, 75-76
- copy function, 26
- guarding, copy, 24
- macros for, 25
- using, 26
- objects, 76
- safe, 25
- type, 45
- variable-length, 24
- switch statement, 16-17
- rule for using, 17
T
- Table definition macros, 22
- for two or more dimensions, 22
- using, 23
- See also macros
- Table loop macros, 23
- using, 23
- See also Macros
- Templates, 71-72
- typedef feature, 45
- using, 47
U
- Unix Source Version Control System (SVCS), 86
- upper_case function, 54-55
- library function implementation of, 55
- pointer implementation of, 55
- "speed-demon," 54
- subscript implementation of, 55
- See also Functions
V
- Values, uninitialized, 11
- See also Return values
- Variable declarations, 29-37
- case-sensitivity and, 66
- EXPORT, 36, 37
- IMPORT, 36, 37
- making, 35
- nested blocks and, 33
- SHARE, 36, 37
- visibility classes and, 33
- See also Declarations; Visibility
- Visibility, 30
- attributes of, 30
- classes of, 33
- concept of, 30
- of C variables, 31
- export, 33
- function rules, 30
- local, 33
- share, 33
- uses of, 30
- variable, 30
- See also Declarations
|