• Like
Deep C Toc
Upcoming SlideShare
Loading in...5
×

Deep C Toc

  • 284 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
284
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
8
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. TABLE OF CONTENTS 0 INTRODUCTION AND BASICS 1 0.0 C - AN OVERVIEW 1 0.1 BRIEF HISTORY OF C LANGUAGE 2 0.2 ANSI C STANDARD 3 0.3 THE FUTURE OF C LANGUAGE 4 0.4 THE LIFETIME OF A C PROGRAM 5 0.5 SOURCE FILES 6 0.6 TRANSLATION PHASES 6 0.7 START-UP MODULE 7 0.8 MAIN() 7 0.9 COMMAND LINE ARGUMENTS 8 0.10 PROGRAM TERMINATION 9 0.11 STRUCTURE OF A C PROGRAM IN MEMORY 9 0.12 STRUCTURE OF A C PROGRAM IN MEMORY 10 0.13 ERRORS 13 1 PROGRAM DESIGN 14 1.1 PORTABILITY 14 1.2 LANGUAGE FEATURES TO AVOID 20 1.3 PERFORMANCE AND OPTIMIZATION CONSIDERATIONS 20 2 CONSTANTS, TYPES AND TYPE CONVERSIONS 23 2.1 VARIABLES 23 2.2 TYPES OF VARIABLES 24 2.3 CONSTANTS 25 2.4 SCALAR TYPE 26 2.5 AGGREGATE TYPE 34 2.6 VOID TYPE 34 2.7 FUNCTION TYPE 34 2.8 DERIVED TYPES 34 2.9 INCOMPLETE TYPES 34 2.10 TYPE SPECIFIERS 35 2.11 TYPE QUALIFIERS 37 2.12 LIMITS OF THE ARITHMETIC TYPES 40 2.13 CREATING TYPE NAMES 41 2.14 TYPE EQUIVALENCE 46 2.15 TYPE CONVERSIONS 46 2.16 EXPLICIT CONVERSIONS 47 2.17 IMPLICIT CONVERSIONS 47
  • 2. 3 DECLARATIONS, DEFINITIONS AND INITIALIZATIONS 51 3.1 DECLARATION 51 3.2 FORWARD REFERENCES 51 3.3 DEFINITION 53 3.4 ORDERING IN DECLARATIONS/DEFINITIONS 56 3.5 SCOPE, LIFETIME AND VISIBILITY 56 3.6 SCOPE 57 3.7 LIFE TIME 59 3.8 VISIBILITY 60 3.9 NAME SPACES 61 3.10 LINKAGE 62 3.11 STORAGE CLASS 64 3.12 COMPLEX DECLARATIONS 66 3.13 INITIALIZATION 67 4 OPERATORS, EXPRESSIONS AND CONTROL FLOW 72 4.1 LVALUES AND RVALUES 72 4.2 DIFFERENCE BETWEEN OPERATORS AND PUNCTUATORS 73 4.3 ‘ARITY’ OF OPERATORS 74 4.4 UNARY EXPRESSIONS 74 4.5 BINARY EXPRESSIONS 79 4.6 TERNARY OPERATOR 83 4.7 ASSIGNMENT EXPRESSION 84 4.8 SEQUENTIAL (COMMA ) OPERATOR 85 4.9 SIGNIFICANCE OF EQUALITY OF OPERATORS 86 4.10 OPERATOR PRECEDENCE 86 4.11 ASSOCIATIVITY 88 4.12 ORDER OF EVALUATION 88 4.13 SIDE EFFECTS 89 4.14 DISCARDED VALUES 91 4.15 CONSTANT EXPRESSIONS 91 4.16 CONTROL FLOW 92 4.17 THE STRUCTURE THEOREM 94 5 POINTERS, ARRAYS AND STRINGS 95 5.1 VOID POINTER 95 5.2 MULTIPLE LEVEL OF POINTERS 95 5.3 SIZE OF A POINTER VARIABLE 96 5.4 POINTERS TO ENUMERATION TYPES 96 5.5 POINTERS TO STRUCTURE MEMBERS 97 5.6 POINTER ARITHMETIC 97 5.7 THE NULL POINTER 99 5.8 ILLEGAL ACCESSES 99 5.9 WILD POINTERS 101 5.10 POINTERS AND CONST QUALIFIER 101 5.11 ARRAYS 103
  • 3. 5.12 ARRAYS AND POINTERS 105 5.13 STRINGS 110 5.14 ARRAYS AND STRINGS 113 5.15 ARRAYS AND STRUCTURES 114 6 STRUCTURES AND UNIONS 115 6.1 INITIALIZING STRUCTURES 115 6.2 NAME EQUIVALENCE OF STRUCTURES 115 6.3 OFFSETOF MACRO 116 6.4 NESTED STRUCTURES 116 6.5 SELF-REFERENTIAL STRUCTURES 117 6.6 PADDING IN STRUCTURES 118 6.7 STRUCTURES AND FUNCTIONS 118 6.8 THE ‘STRUCT HACK’ TECHNIQUE 118 6.9 UNIONS 119 6.10 BIT-FIELDS 121 6.11 PORTABILITY ISSUES 123 7 FUNCTIONS 125 7.1 GENERAL INFORMATION ABOUT FUNCTIONS 125 7.2 FUNCTIONS AS LVALUES 125 7.3 ORGANIZATION OF A C ACTIVATION RECORD 127 7.4 FUNCTION PARAMETERS 127 7.5 ENDIAN PROBLEM 128 7.6 FUNCTION DECLARATION/PROTOTYPES 131 7.7 RETURN VALUES 132 7.8 THE C ARGUMENT PASSING MECHANISM 132 7.9 RECURSION 136 7.10 FUNCTION POINTERS 138 7.11 POLYMORPHIC ROUTINES 140 7.12 LIBRARY FUNCTIONS 140 7.13 DESIGN OF INTERFACE 141 7.14 VARIABLE ARGUMENTS 141 7.15 WRAPPER FUNCTIONS 143 8 DYNAMIC MEMORY ALLOCATION 145 8.1 MEMORY ALLOCATOR 145 8.2 INITIALIZING MEMORY BLOCK 147 8.3 VOID * AND CHAR * 147 8.4 REALLOC() (A COMPLETE MEMORY MANAGER) 147 8.5 FREE() 149 9 PREPROCESSOR 151
  • 4. 9.1 TYPES OF PREPROCESSOR 151 9.2 COMMENTS 152 9.3 LINE CONTINUATION CHARACTER 153 9.4 STRING SUBSTITUTION 153 9.5 PREPROCESSOR CONSTANTS 153 9.6 # (NULL DIRECTIVE) 154 9.7 #LINE 154 9.8 #PRAGMA 155 9.9 HEADER FILES 155 9.10 CONDITIONAL COMPILATION 158 9.11 MACRO PROCESSING 159 9.12 DEFINED OPERATOR 160 9.13 MACROS VS FUNCTIONS 161 9.14 FUNCTION EQUIVALENT FOR MACROS IN STANDARD LIBRARY 162 10 STANDARD HEADER FILES AND I/O 164 10.1 STANDARD HEADER FILES 164 10.2 NAMING CONVENTION 164 10.3 LIBRARY FUNCTION NAMES & VARIABLES 165 10.4 ERROR HANDLING IN LIBRARY FUNCTIONS 165 10.5 <ASSERT.H> 167 10.6 <CTYPE.H> 168 10.7 <ERRNO.H> 168 10.8 <FLOAT.H> AND <LIMITS.H> 169 10.9 <LOCALE.H> 169 10.10 <MATH.H> 169 10.11 <SETJMP.H> 170 10.12 <SIGNAL.H> 170 10.13 <STDARG.H> 172 10.14 <STDDEF.H> 172 10.15 <STDIO.H> 172 10.16 <STDLIB.H> 177 10.17 <STRING.H> 178 10.18 <TIME.H> 179 11 OBJECT ORIENTATION AND C 181 11.2 HOW OBJECT ORIENTATION IS BETTER THAN PROCEDURAL 182 11.3 OBJECT-ORIENTED DESIGN AND PROCEDURAL LANGUAGES 182 11.4 IMPLEMENTING OBJECT ORIENTED DESIGN IN C 183 11.5 C++, JAVA, C# AND OBJECTIVE-C 187 11.6 OBJECTIVE-C 187 12 C AND C++ 189 12.1 THE RAW POWER OF C 189 12.2 SUBTLE DIFFERENCES BETWEEN C AND C++ 190
  • 5. 13 C AND JAVA 201 13.1 HOW JAVA DIFFERS FROM C 201 13.2 JAVA TECHNOLOGY 205 13.3 JAVA NATIVE INTERFACE 207 14 C AND C# 211 14.1 WHAT C# PROMISES? 211 14.2 ‘HELLO WORLD‘ IN C# 212 14.3 DATATYPES IN C# 212 14.4 ARRAYS 213 14.5 STRUCTS AND CLASSES 214 14.6 DELEGATES 214 14.7 ENUMS 215 14.8 CASTING 215 14.9 THE PREPROCESSOR 215 14.10 VARIABLE LENGTH ARGUMENT LISTS 217 14.11 USING ‘NATIVE’ CODE 217 14.12 WRITING ‘UNSAFE’ CODE 217 14.13 OTHER DIFFERENCES 218 15 COMPILER DESIGN AND C 219 15.1 AN OVERVIEW OF COMPILATION PROCESS 219 15.2 AN EXAMPLE 226 15.3 COMPILERS FOR C 227 15.4 PARSING 227 16 OPERATING SYSTEMS AND C 230 16.1 UNIX AND C 230 16.2 WINDOWS PROGRAMMING IN C 231 17 THE NEW C9X STANDARD 236 17.1 PRINCIPLES OF STANDARDIZATION PROCESS 236 17.2 MOST IMPORTANT CHANGES BY C9X 237 17.3 OTHER SIGNIFICANT CHANGES IN C9X 243 APPENDIX I - ANSWERS TO SELECTED EXERCISES 245 APPENDIX II - ANSI C DECLARATIONS 250
  • 6. 17.4 STANDARD C GLOBAL VARIABLES 250 17.5 STANDARD C TYPE DECLARATIONS 250 17.6 STANDARD C STRUCTURE AND UNION DECLARATIONS 250 APPENDIX III - ANSI C IMPLEMENTATION-SPECIFIC STANDARDS 251 SUGGESTED READINGS 255 REFERENCES 256 INDEX 258