I was just wondering if a C++ compiler is taking the source code and creating a binary file out of it with a .exe extension on it or something or does it translate it to assembly first and than assemble it from there. If it is binary I have always wondered how it is structured i mean im pretty sure it isnt just a file that in notepad looks like 10100100010101011 but is it possibly to actually write to machine code using fstream or w.e. Thanks in advance
cam875
1
Junior Poster
Recommended Answers
Jump to PostIt depends on the compiler. Both methods have been done, as well as translating from C++ to C, which is then compiled however the C compiler handles it. However, you'll find that most compilers have a switch that give you assembly output whether the compiler itself has a separate assembly …
Jump to PostThe compiler creates a program in several steps before generating the *.exe file. How exactly that is accomplished is different for each compiler.
>>If it is binary I have always wondered how it is structured
Depends on the compiler. See
Jump to Post>so are you saying that with work its possible to write your own assembler
>that converts the source code right into machine code sort of like NASM.
How do you think NASM was written? :icon_rolleyes:>And is it possible to write straight to a Raw .bin file
…
Of course.
All 9 Replies
Narue
5,707
Bad Cop
Team Colleague
cam875
1
Junior Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Narue
5,707
Bad Cop
Team Colleague
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
cam875
1
Junior Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Narue
5,707
Bad Cop
Team Colleague
ArkM
1,090
Postaholic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.