mirror of
https://gitlab.com/blau_araujo/cblc.git
synced 2025-05-10 02:26:36 -03:00
107 lines
2 KiB
Org Mode
107 lines
2 KiB
Org Mode
|
#+title: Curso Básico da Linguagem C
|
||
|
#+subtitle: Aula 1: História
|
||
|
#+author: Blau Araujo
|
||
|
#+startup: show2levels
|
||
|
#+options: toc:3
|
||
|
|
||
|
* Aula 1: História
|
||
|
|
||
|
[[https://youtu.be/wqJQL5W9FIw][Vídeo desta aula]]
|
||
|
|
||
|
** Principais momentos...
|
||
|
|
||
|
- Ken Thompson cria a linguagem B (1969) para ter uma linguagem de alto nível
|
||
|
para reescrever o UNIX.
|
||
|
|
||
|
- Dennis Ritchie continua aprimorando a linguagem B.
|
||
|
|
||
|
- Em 1972, a linguagem B está tão diferente que recebe o nome de linguagem C.
|
||
|
|
||
|
- Em 1978, Brian Kernighan e Dennis Ritchie lançam o livro: /The C Programming
|
||
|
Language/, que acaba se tornando a primeira especificação da linguagem.
|
||
|
|
||
|
- Entre 1983 e 1989, são escritas as primeiras especificações ANSI (ISO/IEC)
|
||
|
para a linguagem.
|
||
|
|
||
|
- Os racunhos de 1987 (C87) são utilizados para escrever a segunda edição do
|
||
|
livro, com o nome de /The ANSI C Programming Language/.
|
||
|
|
||
|
** Características da linguagem C...
|
||
|
|
||
|
- Linguagem compilada
|
||
|
- De alto nível
|
||
|
- De uso geral
|
||
|
- Imperativa
|
||
|
- Procedural
|
||
|
- Estruturada
|
||
|
|
||
|
** Implementação GNU/Linux...
|
||
|
|
||
|
*** Compilador:
|
||
|
|
||
|
- /GNU Compiler Collection/ (=gcc=)
|
||
|
|
||
|
*** Biblioteca C Padrão:
|
||
|
|
||
|
- GNU Libc (=glibc=)
|
||
|
|
||
|
** Compilação...
|
||
|
|
||
|
Transformação do código-fonte em texto do programa para um código binário em
|
||
|
linguagem de máquina.
|
||
|
|
||
|
*** Etapas:
|
||
|
|
||
|
1 - Pré-processamento:
|
||
|
|
||
|
#+begin_example
|
||
|
gcc -E arquivo.c → Saída padrão
|
||
|
#+end_example
|
||
|
|
||
|
2 - Compilação:
|
||
|
|
||
|
#+begin_example
|
||
|
gcc -S arquivo.c → arquivo.s (fonte em assembly)
|
||
|
#+end_example
|
||
|
|
||
|
3 - Montagem:
|
||
|
|
||
|
#+begin_example
|
||
|
gcc -c arquivo.c → arquivo.o (objeto binário)
|
||
|
#+end_example
|
||
|
|
||
|
4 - Link-edição:
|
||
|
|
||
|
#+begin_example
|
||
|
gcc arquivo.c → a.out (arquivo binário executável)
|
||
|
#+end_example
|
||
|
|
||
|
** Exemplo de um programa em C...
|
||
|
|
||
|
Programa =salve.c=:
|
||
|
|
||
|
#+begin_src c
|
||
|
#include <stdio.h>
|
||
|
|
||
|
int main(void) {
|
||
|
|
||
|
puts("Salve, simpatia!");
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
#+end_src
|
||
|
|
||
|
*** Compilação:
|
||
|
|
||
|
#+begin_example
|
||
|
:~/git/cblc/aulas/01-historia$ gcc -o salve salve.c
|
||
|
#+end_example
|
||
|
|
||
|
*** Execução:
|
||
|
|
||
|
#+begin_example
|
||
|
:~/git/cblc/aulas/01-historia$ ./salve
|
||
|
Salve, simpatia!
|
||
|
#+end_example
|
||
|
|