LibCoder

Deep C Dives: Adventures in C

1C Agda C
Deep C Dives: Adventures in C
Автор: James Mike
Дата выхода: 2024
Издательство: I/O Press
Количество страниц: 216
Размер файла: 1,2 МБ
Тип файла: PDF
Добавил: LibCoder
Оглавление
The PrologC 11Machine-Independent Assembler?....11The History....13Standards....14Compilers Today....15C++....15Being True to C....16How to Read this Book....17Dive 1All You Need Are Bits 19States....19Specifying Bit Patterns....20Place Value Systems....21Binary....24Binary Arithmetic....26Rollover....27Negative Numbers....28Dive 2These aren’t the types you’re looking for 31The Origin of Type....31C Types....32Word Size....32Data Representation....33The Usual Types....34Floats....35The Usual Literals....35Precise Types....36Char Type....37Printf and Type....39Unicode....40Final Thoughts....42Dive 3Type Casting 43Casting....43Negative Problems....45Static or Dynamic Casting....46Floating Point....47Final Word....47Dive 4Expressions 49Expressions and Statements....49C Expressions....51Compile v Runtime Expressions....53Lvalues and Rvalues....53Side Effects and Sequence Points....54Auto Promotion....56Some Oddities....58Dive 5Bits and More Bits 63Addressing the Bit....63The Bitwise Operators....64Signed v Unsigned....65Masks....66A Single Function To Write Bits....68Reading Bits....69Shifting Values....70Significant Bits....72Endianism....72Rotate....74Bit Fields....75Some Examples....77Dive 6The Brilliant But Evil for 81Quick Guide To The Loop Zoo....81Conditional Loops....82The C for Loop....82While and Until....84Break and Continue....85Find It and Fix It....86The Evil Parts....88Final Thoughts....88Dive 7Into the Void 89Why Void?....89Void In C....90Void Expressions....91The Void Type....92Final Word....94Dive 8Blocks, Stacks and Locals 95The Need To Return....95Automatic Local Variables....97Dead Data....99Blocks....101Final Word....103Dive 9Static Storage 105File Level Storage....106Global Variables....108Declaring and Defining....108Static....109Static v Heap....111Dive 10Pointers 113The Address Operator....113The Pointer....115Dereferencing....115Lifetime Problems....116Operator or Type?....118Pointers, Arrays and Heaps....118Dive 11The Array and Pointer Arithmetic 119The Storage Mapping Function....119Index Notation....120Arrays Are Pointers....121Pointer Arithmetic....122Pointer to Array....123Casting Pointers....124More Than One Dimension....124Pointers to Pointers....126Strings As NULL-Terminated Arrays....128Dive 12Heap, The Third Memory Allocation 131The Heap....131Malloc and friends....132Casting....134Dynamic Allocation....135Dynamic Multidimensional Arrays in C89....136Reallocating....137The Variable Length Array....138VLA Type and Dynamic Multidimensional Arrays....138Heap or Stack....139Dive 13First Class Functions 141The C Function....141Partial Evaluation and Currying....142Functions First....143Function Pointers and Type....145Function Parameters and Return Types....147Parameters and Arguments....149Calling Conventions....152Ignoring Parameters....153Variadic....154Return....157Functions and Big Data....158Returning More Than One Result....159Inline Functions....160C Functions Considered....161Dive 14Structs and Objects 163The Struct....163Value Semantics....165It’s Just a Block of Memory....166Padding....166Type Punning....167Structs As Objects....170The Array At The End Of The Struct....173Final Thoughts....174Dive 15The Union 175Union Basics....175Color....176Type Punning Unions....177When Unions Don’t Hack It....178Tagged Union....179Final Thoughts....180Dive 16Undefined Behavior 181An Optimization Too Far....181Undefined Behavior....184UB in Practice....185Divide By Zero and Undefined Behavior....186Signed Overflow....187Strict Aliasing....189Dive 17Exceptions and the Long Jump 193The Idea of an Exception....193Setjmp Non-local Jumps....196Try Catch Macros....197Handle or Reraise....198Restrictions....201Linux Signals....202goto versus longjmp....204Final Word....204

Описание

Коротко и по делу о том, что важно знать про that.

Being one step up from assembler, it keeps the programmer close to the hardware and if you want to understand how your code takes control without all of the abstractions applied in other languages, C is the one to choose. C is a language with a long past and probably a long future. The only problem is that many books and articles on the subject of C are written by programmers who are happier in higher-level languages – they tend to look down on C and try to explain it as if it were a defective Java or some other language. This reveals that C has a very special place among the programming languages of today as a powerful and versatile option for low-level programming, something that is often overlooked in books written by programmers who would really rather be using a higher-level language. In Deep C Dives, Mike James provides in-depth exploration of the essence of C, identifying the strengths of its distinctive traits. To emphasize the way in which chapters of this book focus on specific topics, they are referred to as “dives”, something that also implies a deep examination of the subject, suitable for programmers who already program in C. You will also read things that take you into the lesser-understood areas of the C language, which only make sense when you view C as a machine-independent assembly language, which is a good way to find out more about how the machine works and influences the way things are implemented. The intention is that you will encounter some things that you already know but will come to see them differently. Topics delved into include: bit patterns, arithmetic, how C types are different, casting, expressions, the evil for, what’s void, blocks, locals, the stack, heap and static storage, pointers, arrays, multidimensional arrays as pointers, first class functions, structs, type punning, unions, undefined behavior and exceptions.

Файл доступен для загрузки ниже.

that language deep dives languages programmers level which

Частые вопросы

Можно ли скачать «Deep C Dives: Adventures in C» бесплатно?

Да, «Deep C Dives: Adventures in C» доступна для бесплатного скачивания на нашем сайте в формате PDF. Ссылка на файл находится на этой странице.

В каком формате и какого размера файл?

Книга предоставляется в формате PDF, размер файла 1,2 МБ.

Кто автор и когда вышла книга?

автор — James Mike, издательство I/O Press, год выпуска 2024, 216 страниц.

О чём книга «Deep C Dives: Adventures in C»?

C is a language with a long past and probably a long future.

Похожие материалы