Inside C
- Length: 261 pages
- Edition: 1
- Language: English
- Publication Date: 2017-10-13
- ISBN-10: B076G6L2GT
- Sales Rank: #1955164 (See Top 100 Books)
This book has the same practical approach as the previous “Stack Frames: A look from inside” where the reader can find useful information on many of the topics addressed here. By focusing on the main subjects, it reviews some implementation details that are often overlooked or left out when studying the C language for the first time.
Therefore, the book is addressed mainly to students who have already learned the language and wish to achieve a better understanding of it by observing how the source code is translated by compilers. It gives a different point of view: a look downwards. It’s a chance to explore a world so mysterious and exciting, whose importance is often undervalued. The Author has always believed that knowing the Assembly language is a necessary cultural background for every C programmer.
Assembly and C are so similar that comparing source codes doesn’t require much effort, even for beginners. In fact, below the C there is only one language: the Assembly for a specific CPU. The trouble of looking at the assembly code and comparing it with the C source is amply repaid by the knowledge of how computers work and how to optimize code snippets that are responsible for slowing down the executable, assuming the proper algorithm and optimization options have already been chosen.
But we cannot drill down to lower level of detail without having to give up something; since there are many architectures, assembly languages and compilers, it’s necessary to make choices. The working environment will be a GNU operating system installed on a personal computer with a 64-bit x86 processor. The working tools will be two compilers (gcc, clang) and a debugger (gdb).
There are also available online compilers, for instance rextester (http://rextester.com/) which allows to write, compile and execute programs using several compilers and languages, including C and Assembly. There are even websites (e.g. https://godbolt.org/) boasting the ability to provide the assembly code and show it either with AT&T or Intel syntax.
Another difference from traditional C books is the conversational style: few chapters covering only the most important topics of the language and, often, long sections with poorly detailed definitions but rich with examples and tests to be carried out by the reader.
If the reader has never studied C and assembly, don’t worry: nearly all the instructions have enough comments, images and information to ensure full understanding. The only requirement is the desire to learn.
Table of Contents
- BASICS
- ASSEMBLY
- C LANGUAGE
- CONSTANTS
- VARIABLES
- POINTERS
- ARRAYS
- STRUCTURES, UNIONS, BIT-FIELDS