GCC & In n Out

Lisa Olson
2 min readJan 18, 2018

--

What happens when I type gcc main.c ?

Ultimately, it all goes back to zeros and ones. The computer doesn’t understand English or even the code we’re writing when we’re programming in JavaScript, Ruby, or C. The only thing the computer can understand is binary. This means that every piece of code has to go through a process so that the computer is ultimately given something it understands.

This is where gcc main.c comes in. The first part of this command is gcc. Gcc stands for GNU Compiler Collection. This is a compiler system produced by the GNU project that supports a variety of programming languages. For most Unix Operating systems, this is the standard compiler.

The process of compilation starts with the source code. This is the main.c file. Gcc begins by looking at the file you tell it to look at which is the preprocessor. The preprocessor looks at the .c file, removes any comments that may exist, and includes header files in the source code.

After this comes the compiler. The compiler takes the file and generates assembly code. This assembly code gets passed to the assembler. The assembler converts the assembly code into object code, also known as machine code, or binary.

Once it is in binary, linker takes over to pack everything into one single file. So linker gathers all the object codes using functions from the library to create the final executable file.

An example of how this works would be ordering food at In N Out. I pick the number that I really like and say a specific phrase, ‘I want a number 2 please’. And from there, there’s a specific and well-designed process that sets off. The cashier presses the 2 button, the money exchanges, the ticket is sent to the back, the food order is passed from person to person until finally it’s placed in a bag and my number is called. All I had to do was say, ‘I want a number 2’. Similar to typing in, ‘gcc main.c.’ And the process begins.

--

--

Lisa Olson
Lisa Olson

Written by Lisa Olson

Front End Developer. Passionate about everything I do. How we spend our days is how we spend our lives.

No responses yet