Click here to Skip to main content
15,867,488 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionis it okeedokee to include defining headers hither and yon all over the place Pin
BernardIE53179-Feb-23 6:28
BernardIE53179-Feb-23 6:28 
AnswerRe: is it okeedokee to include defining headers hither and yon all over the place Pin
Mircea Neacsu9-Feb-23 7:08
Mircea Neacsu9-Feb-23 7:08 
GeneralRe: is it okeedokee to include defining headers hither and yon all over the place Pin
BernardIE53179-Feb-23 7:46
BernardIE53179-Feb-23 7:46 
GeneralRe: is it okeedokee to include defining headers hither and yon all over the place Pin
Mircea Neacsu9-Feb-23 8:06
Mircea Neacsu9-Feb-23 8:06 
GeneralRe: is it okeedokee to include defining headers hither and yon all over the place Pin
BernardIE53179-Feb-23 8:46
BernardIE53179-Feb-23 8:46 
AnswerRe: is it okeedokee to include defining headers hither and yon all over the place Pin
jschell9-Feb-23 9:34
jschell9-Feb-23 9:34 
QuestionCompilers Pin
Calin Negru2-Feb-23 9:24
Calin Negru2-Feb-23 9:24 
AnswerRe: Compilers Pin
Mircea Neacsu2-Feb-23 9:56
Mircea Neacsu2-Feb-23 9:56 
Calin Negru wrote:
A C# program is compiled with a compiler written in c++
A C++ program is compiled with a compiler written in assembly
An assembly program is compiled with a compiler written with machine instructions
Is that roughly how it works?

Not exactly. It isn't a hierarchy where each language is translated in a lower level language. Let's put aside the C# for the moment because it isn't not exactly compiled (I'll explain in a bit). For the other languages the compiler is a machine language program (the processor cannot execute anything else) that translates the source code directly into machine language. In general you don't care in what language the compiler was written. These days it's rare to have an assembler or compiler written in assembly language. Most/all of them are written in C, C++ or other high level languages.

C# is a bit different because the compiler translates the source program into code for a virtual machine. This is called IL (intermediate language). When the program gets executed, the parts that need to be executed are translated into machine code. This is called Just-In-Time (JIT) compiling.

Edit: I left out a lot of details and exceptions. For instance the first C++ "compiler" was actually a preprocessor that translated C++ to plain C. This is a very rough sketch.
Mircea

AnswerRe: Compilers Pin
Dave Kreskowiak2-Feb-23 10:08
mveDave Kreskowiak2-Feb-23 10:08 
GeneralRe: Compilers Pin
trønderen2-Feb-23 12:41
trønderen2-Feb-23 12:41 
GeneralRe: Compilers Pin
Dave Kreskowiak2-Feb-23 12:43
mveDave Kreskowiak2-Feb-23 12:43 
GeneralRe: Compilers Pin
jschell3-Feb-23 5:17
jschell3-Feb-23 5:17 
GeneralRe: Compilers Pin
Calin Negru2-Feb-23 21:29
Calin Negru2-Feb-23 21:29 
GeneralRe: Compilers Pin
Dave Kreskowiak3-Feb-23 11:32
mveDave Kreskowiak3-Feb-23 11:32 
GeneralRe: Compilers Pin
trønderen3-Feb-23 12:40
trønderen3-Feb-23 12:40 
AnswerRe: Compilers Pin
trønderen2-Feb-23 13:54
trønderen2-Feb-23 13:54 
GeneralRe: Compilers Pin
Calin Negru2-Feb-23 22:27
Calin Negru2-Feb-23 22:27 
GeneralRe: Compilers Pin
Richard MacCutchan2-Feb-23 23:16
mveRichard MacCutchan2-Feb-23 23:16 
GeneralRe: Compilers Pin
Calin Negru4-Feb-23 5:47
Calin Negru4-Feb-23 5:47 
AnswerRe: Compilers Pin
jschell3-Feb-23 5:21
jschell3-Feb-23 5:21 
AnswerRe: How it came to be. Pin
Jeremy Falcon6-Feb-23 9:11
professionalJeremy Falcon6-Feb-23 9:11 
GeneralRe: How it came to be. Pin
jsc426-Feb-23 23:14
professionaljsc426-Feb-23 23:14 
GeneralRe: How it came to be. Pin
Jeremy Falcon7-Feb-23 3:25
professionalJeremy Falcon7-Feb-23 3:25 
AnswerRe: Compilers Pin
BernardIE53179-Feb-23 8:51
BernardIE53179-Feb-23 8:51 
QuestionMessage Closed Pin
1-Feb-23 14:01
Member 149687711-Feb-23 14:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.