Is saying: compiling a program practically wrong?

I think when we say compiling a program, we include implicitly preprocessing it, which is not a compilation of a program text, am I right or wrong?
Only pedants would say "pre-process, compile, assemble and link" everytime, if all you're doing is g++ prog.cpp. Just saying "compile" and everyone would know what you mean.

Sure, if you're only interested in the pre-processing step, say to try and figure out some weird #define macro expansion, using say g++ -E prog.cpp, then you would say pre-process prog.cpp.

When you get to multiple source files in a project, either through using tools like make or cmake, or your IDE's project system, saying "build" is common.
Only pedants would say "pre-process, compile, assemble and link" everytime

I respectfully disagree here. It may seem a shortcut to express an idea(which make it technically right) but it is still a wrong expression I guess(practically wrong), and will miss-lead ones who new to the subject like me. so some may say pedants others may say precise)

I prefer build, but I am not asking to change anything. Just want to know if preprocessing is part of compilation.
Just want to know if preprocessing is part of compilation.

Yes. Macros are translated to the target language.
@kbw wrote:
Yes. Macros are translated to the target language.
, now you making me very confused. I will quote from three different places:

Link 1:
Preprocessors are programs that process our source code before compilation

Link 2:
The preprocessor is executed at translation phase 4, before the compilation. The result of preprocessing is a single file which is then passed to the actual compiler.

Professional C++, Marc Gregoire Edition 4
Building a C++ program is a three-step process. First, the code is run through a preprocessor, which recognizes meta-information about the code. Next, the code is compiled, or translated into machine-readable object files.

Here clearly! the preprocessing is happening before compilation, so it is not a part of compilation I guess
It depends upon what you mean by 'compilation'...

There are 3 stages - pre-processing, compilation to object file(s) and linking these object files to form a .exe/.dll file to be used. Usually by 'compilation' it refers to this whole process. A C++ compiler would be expected to perform all. You don't obtain a pre-processor, a source compiler and a linker as separates. You get them as one package.

Last edited on
The meaning of the word “compile” is at issue here.

If by “compile” you mean invoke the TU → AST → obj steps then yes, you must be a pedant or a writer/maintainer of a compiler toolchain.

If by “compile” you mean invoke the program that takes source code and produces an executable then yes, preprocessing is part of compilation.

Definitions matter.
@seeplus, I understand, I just find it weird when I read
There are 3 stages - pre-processing, compilation to object file(s) and linking
Usually by 'compilation' it refers to this whole process
. I would prefer they named the last compilation something else.

It is like if you fall, break a hip, a skull, and big bone, then someone asks you what happened, and to not be pedant you answer my skull broke, and by definition he he will understand the rest of your broken bones.

@Duthomhas wrote:
invoke the TU → AST → obj
, I do not know what TU and AST mean.

But your answer is what I need, there is two definitions, and from the few books I read no one mention that.
its probably sloppy, but if you want to communicate with others in the field, you will just have to memorize the terms and understand the usage.
99% of the time when someone is talking about compile, it means 'the build process'. Once in a while, and it will be obvious from the rest of the conversation in context, it will mean 'the compile step of the build process'.

Your example isnt really a good comparison.
its more like they ask what happened, and you say "I fell down". That gives them the big picture with zero details; which is what is normally going on when someone says they compiled (built) a program. I mean, if you REALLY step back from it...
say you bump into a college buddy 10 years after graduation at the coffee shop and heard him say "I compiled the release candidate last night".
- you don't know what OS(s) it was built for, nor what compiler/platform was used.
- you don't even know if it was in basic, java, python, or fortran.
- you don't know if he linked object files, or if he needed to do so (not all languages do it this way)
- you don't know anything more than that his efforts produced a program!

and yet, you know enough to guess that he probably meant to say "I BUILT the release candidate last night". You know this because 99% of the time... that is what is meant :)

And no typical book is going to say this. Books give a 10 cent gloss-over of the build process, and then they dive into the matter at hand, teaching you the language.
Last edited on
it means 'the build process'
exactly, that's the word I like to be used, but I am not trying to force it, I volunteerly want to belong to the 99%

its more like they ask what happened, and you say "I fell down".
. Here I think you miss-understood me, I wanted to say for example, that we agree that by definition if you say i broke my skull it mean also that you broke a hip and a big bone. the same way when we say compiling a program and meaning preprocessing, compiling and liking it. that why I said
and by definition he he will understand the rest of your broken bones.

The rest of what you said I agree with it.

Note: I am one of those 99% with a little difference, I ask UNIQUE questions)
Call it 'compile,' call it 'build' or even call it 'snigglefritz.'

What you are doing is translating human written, human readable source code into a form that can perform (execute) the steps of logic as expressed in the source.

That requires 3 (or 4) distinct steps/stages with C/C++ code. After all we are basically trying to instruct a rock how to perform digital tasks by manipulating voltages.

1. Preprocessing
2. Compilation
3. Assembling
4. Linking

The compilation and assembly stage are usually treated as one, so the process becomes Preprocessing, Compilation and Linking.

Humans being humans, even programmers, tend to be sloppy and sometimes imprecise when it comes to terminology. Lots of people mention the STL when they talk about the C++ stdlib. *BUZZ*

Pedantically speaking the STL and the C++ stdlib are two entirely different entities. Though they are related. One (the STL) influenced the other.

I personally would never say the C++ stdlib and the STL are "the same," but if someone does use that STL terminology as meaning the C++ stdlib I will understand what they are saying.

Though clearly the C++ toolbox is much larger than just templates.

Don't sweat the academic fancy froo-froo nonsense, learn and understand what is happening in the trenches in the war of programming.

Yes, definitions DO matter, otherwise communication between hoomans is nigh um-possible, but being overly rigid and pedantic is emphasizing form over substance. With a potential loss of interest and understanding.

Saying "compiling" when talking about the entire 3/4 stage process is easily understood shorthand.

So, to circle back to your opening question....

No, saying "compile" when meaning more is not wrong. Nor is it imprecise since the single word conveys a commonly understood meaning.

"When I use a word... it means just what I choose it to mean" -- Humpty Dumpty in 'Alice in Wonderland'.
I think we do this all the time when speaking. We mention the main action and a lot of things are implicit or irrelevant.

I can say "I went to the zoo yesterday" but I do not need to mention how I got there. The fact that I actually stayed in line, paid and went inside and saw animals can probably be assumed. Of course, if you care about the details you could always ask me.

In most situations when we talk about "compiling a program" we are not very interested in the preprocessor step. We know that it always happens so we do not need to mention it.
Last edited on
Last time I went to the zoo it was against my will.

Fortunately there were a bunch of little waterfowl there that helped me escape when no one was looking.

Unfortunately there’s this crazy French lady still trying to find me. I keep my head down these days and just buzz around C++ programming forums.
"This is the type of arrant pedantry up with which I will not put." - Winston Churchill

Someone left the cake out in the rain ...
Can someone explain what
TU → AST → obj
TU → AST → obj
Some people claim Winston Churchill had a deep understanding of translation units, abstract syntax trees and object code.
Others say "I just asked what time it is, not how to build a watch".
TU ::= translation unit
(All the text and any metadata attached to a single source code file)

AST ::= abstract syntax tree
(How a program is represented internally by the compiler)
Thanks @Duthomhas
Topic archived. No new replies allowed.