1

I learned that a compilation process makes source codes into machine codes so that the output machine codes are CPU architecture-specific.

And precompiled headers are precompiled. Then how can a computer with an arbitrary CPU (and its architecture) know the kind of machine code of this header and interpret this precompiled header? Is there any universal machine code for it? If not how it works?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
WindBag
  • 63
  • 7
  • 1
    Different compilers may do this differently; do you have a particular one in mind? The term "precompiled" may be a slight misnomer; it may be that only some stages of compilation are done, e.g. parsing and generation of an AST or intermediate representation which may or may not be machine dependent. Typically the header alone doesn't even contain enough information to actually generate machine code, until the compiler also sees how the program uses the contents of the header. – Nate Eldredge Dec 26 '20 at 06:08
  • @NateEldredge I don't have a particular case in mind. I was just curious after I learned the concept of precompiled header and I searched for some example cases but weren't enough... Can you please add an answer with some cases? – WindBag Dec 26 '20 at 06:13

0 Answers0