Curso de c++ (mit)

Solo disponible en BuenasTareas
  • Páginas : 3 (615 palabras )
  • Descarga(s) : 0
  • Publicado : 6 de febrero de 2012
Leer documento completo
Vista previa del texto
Introduction to C++ Massachusetts Institute of Technology

January 4, 2011 6.096

Lecture 1 Notes: Introduction 1
1.1

Compiled Languages and C++
Why Use a Language Like C++?

At its core,a computer is just a processor with some memory, capable of running tiny instructions like “store 5 in memory location 23459.” Why would we express a program as a text file in a programming language,instead of writing processor instructions? The advantages: 1. Conciseness: programming languages allow us to express common sequences of com­ mands more concisely. C++ provides some especially powerfulshorthands. 2. Maintainability: modifying code is easier when it entails just a few text edits, instead of rearranging hundreds of processor instructions. C++ is object oriented (more on that inLectures 7-8), which further improves maintainability. 3. Portability: different processors make different instructions available. Programs writ­ ten as text can be translated into instructions for manydifferent processors; one of C++’s strengths is that it can be used to write programs for nearly any processor. C++ is a high-level language: when you write a program in it, the shorthands are sufficientlyexpressive that you don’t need to worry about the details of processor instructions. C++ does give access to some lower-level functionality than other languages (e.g. memory addresses).

1.2

TheCompilation Process

A program goes from text files (or source files) to processor instructions as follows:
Source File Compiler Object File Linker Source File Compiler Object File Libraries ExecutableOS Program in Memory

Object files are intermediate files that represent an incomplete copy of the program: each
source file only expresses a piece of the program, so when it is compiled into anobject file,
the object file has some markers indicating which missing pieces it depends on. The linker


takes those object files and the compiled libraries of predefined code that they rely on,...
tracking img