aboutsummaryrefslogtreecommitdiff
path: root/content/blog/2018-11-28-cpp-compiler.org
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2025-11-11 19:42:10 -0600
committerChristian Cleberg <[email protected]>2025-11-11 19:42:10 -0600
commitf1f35bd4070c7dd0d232c5a3f2f7373511475565 (patch)
tree8d44604b7a27a1f6f4a5fd4fb8df8894a92aa8e5 /content/blog/2018-11-28-cpp-compiler.org
parentceb109db053608774d340fa820615bd9c04fa436 (diff)
downloadcleberg.net-f1f35bd4070c7dd0d232c5a3f2f7373511475565.tar.gz
cleberg.net-f1f35bd4070c7dd0d232c5a3f2f7373511475565.tar.bz2
cleberg.net-f1f35bd4070c7dd0d232c5a3f2f7373511475565.zip
fix grammar in 2018 posts
Diffstat (limited to 'content/blog/2018-11-28-cpp-compiler.org')
-rw-r--r--content/blog/2018-11-28-cpp-compiler.org46
1 files changed, 24 insertions, 22 deletions
diff --git a/content/blog/2018-11-28-cpp-compiler.org b/content/blog/2018-11-28-cpp-compiler.org
index 6507f4e..817b32e 100644
--- a/content/blog/2018-11-28-cpp-compiler.org
+++ b/content/blog/2018-11-28-cpp-compiler.org
@@ -8,10 +8,10 @@
[[https://en.wikipedia.org/wiki/C%2B%2B][C++]] is a general-purpose programming language with object-oriented, generic, and
functional features in addition to facilities for low-level memory manipulation.
-The source code, shown in the snippet below, must be compiled before it can be
-executed. There are many steps and intricacies to the compilation process, and
-this post was a personal exercise to learn and remember as much information as I
-can.
+A developer must compile source code, such as the example shown in the snippet
+below, before they can execute the compiled program. There are numerous steps
+and intricacies to the compilation process, and this post was a personal
+exercise to learn and remember as much information as I can.
#+begin_src cpp
#include <iostream>
@@ -36,9 +36,10 @@ is not the only compiled language. Check out [[https://en.wikipedia.org/wiki/Com
languages]] for more examples of compiled languages.
I'll start with a wonderful, graphical way to conceptualize the C++ compiler.
-View [[https://web.archive.org/web/20190419035048/http://faculty.cs.niu.edu/~mcmahon/CS241/Notes/compile.html][The C++ Compilation Process]] by Kurt MacMahon, an NIU professor, to see the
-graphic and an explanation. The goal of the compilation process is to take the
-C++ code and produce a shared library, dynamic library, or an executable file.
+View [[https://web.archive.org/web/20190419035048/http://faculty.cs.niu.edu/~mcmahon/CS241/Notes/compile.html][The C++ Compilation Process]] by Kurt MacMahon, a Northern Illinois
+University (NIU) professor, to see the graphic and an explanation. The goal of
+the compilation process is to take the C++ code and produce a shared library,
+dynamic library, or an executable file.
** Compilation Phases
@@ -61,10 +62,11 @@ the expanded code.
*** Step 2
-After the code is expanded, the compiler comes into play. The compiler takes the
-C++ code and converts this code into the assembly language, understood by the
-platform. You can see this in action if you head over to the [[https://godbolt.org][GodBolt Compiler
-Explorer]], which shows C++ being converted into assembly dynamically.
+After the compiler expands the code, the compiler comes into play. The compiler
+takes the C++ code and converts this code into the assembly language, understood
+by the platform. You can see this in action if you head over to the [[https://godbolt.org][GodBolt
+Compiler Explorer]], which shows the compiled converting C++ into assembly
+dynamically.
For example, the =Hello, world!= code snippet above compiles into the following
assembly code:
@@ -113,17 +115,17 @@ _GLOBAL__sub_I_main:
*** Step 3
-Third, the assembly code generated by the compiler is assembled into the object
-code for the platform. Essentially, this is when the compiler takes the assembly
-code and assembles it into machine code in a binary format. After researching
-this online, I figured out that a lot of compilers will allow you to stop
-compilation at this step. This would be useful for compiling each source code
-file separately. This saves time later if a single file changes; only that file
-needs to be recompiled.
+Third, the compiled assembles the assembly code into the object code for the
+platform. Essentially, this is when the compiler takes the assembly code and
+assembles it into machine code in a binary format. After researching this
+online, I figured out that a lot of compilers will allow you to stop compilation
+at this step. This would be useful for compiling each source code file
+separately. This saves time later if a single file changes, since the developer
+will only need to re-compile single file.
*** Step 4
-Finally, the object code file generated by the assembler is linked together with
-the object code files for any library functions used to produce a shared
-library, dynamic library, or an executable file. It replaces all references to
-undefined symbols with the correct addresses.
+Finally, the compiler links the object code file generated by the assembler
+together with the object code files for any library functions used to produce a
+shared library, dynamic library, or an executable file. It replaces all
+references to undefined symbols with the correct addresses.