Compiled and interpreted languages

Two ways of running code: a compiler translates source into machine code before execution, while an interpreter executes code at run time. Many platforms combine the two.

A compiled language, such as C, C++, Go or Rust, is translated by a compiler into native machine code before it is distributed, and the resulting executable runs directly on the processor. An interpreted language, such as Python, JavaScript or PHP, is traditionally read and executed at run time by an interpreter, although modern engines often compile it internally as it runs. Many platforms sit between the two: Java and .NET compile source into an intermediate bytecode, which a runtime environment then interprets or compiles just in time.

The security differences are often overstated. Compiled executables hide source code from casual reading, but they can be decompiled or reverse engineered, so compiling is not a confidentiality control. Interpreted code is often shipped as readable source, which exposes its logic and any secrets written into it. A larger factor is memory management: C and C++ leave memory handling to the programmer, which is where classic buffer overflows come from, while memory-safe languages and managed runtimes remove much of that class of flaw. NIST SP 800-218 also asks organisations to configure compilers and interpreters to improve executable security.

Exam relevance: questions in this area tend to turn on what compilation does and does not protect. Candidates are expected to recognise that compiled code can still be reverse engineered, and that memory-unsafe languages carry a higher risk of overflow flaws.