I had a strange bug in my program, and after a few hours of debugging, I found the following very stupid line:
int a = b * (c * d * + e)
If you don't see it: Between d
and e
I wrote * +
, where just a +
was intended.
Why does this compile and what does it actually mean?
A compiler takes the program code (source code) and converts the source code to a machine language module (called an object file). Another specialized program, called a linker, combines this object file with other previously compiled object files (in particular run-time modules) to create an executable file.
Compilers are utility programs that take your code and transform it into executable machine code files. When you run a compiler on your code, first, the preprocessor reads the source code (the C++ file you just wrote). The preprocessor searches for any preprocessor directives (lines of code starting with a #).
No. C++ -> C was used only in the earliest phases of C++'s development and evolution. Most C++ compilers today compile directly to assembler or machine code. Borland C++ compiles directly to machine code, for example.
Compilation: the compiler takes the pre-processor's output and produces an object file from it. Linking: the linker takes the object files produced by the compiler and produces either a library or an executable file.
The +
is interpreted as an unary plus operator. It simply returns the promoted value of its operand.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With