mirror of
https://gitlab.com/blau_araujo/cblc.git
synced 2025-05-10 02:26:36 -03:00
Conteúdo da aula 1
This commit is contained in:
parent
36e32ce72c
commit
dfacc175dc
3 changed files with 115 additions and 0 deletions
|
@ -18,4 +18,5 @@ qualquer distribuição.
|
||||||
** Anotações e vídeos
|
** Anotações e vídeos
|
||||||
|
|
||||||
- [[./aulas/00-intro/README.org][Aula 0: Sobre o curso]] ([[https://youtu.be/RZmfuuABTHY][vídeo]])
|
- [[./aulas/00-intro/README.org][Aula 0: Sobre o curso]] ([[https://youtu.be/RZmfuuABTHY][vídeo]])
|
||||||
|
- [[./aulas/01-historia/README.org][Aula 1: História]] ([[https://youtu.be/wqJQL5W9FIw][vídeo]])
|
||||||
|
|
||||||
|
|
106
aulas/01-historia/README.org
Normal file
106
aulas/01-historia/README.org
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
#+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
|
||||||
|
|
8
aulas/01-historia/salve.c
Normal file
8
aulas/01-historia/salve.c
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
|
||||||
|
puts("Salve, simpatia!");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue