Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
rust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
orestis.malaspin
rust
Commits
f0660703
There was a problem fetching the pipeline summary.
Commit
f0660703
authored
7 years ago
by
orestis.malaspin
Browse files
Options
Downloads
Patches
Plain Diff
ajout debut types
parent
bedf92b8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+4
-1
4 additions, 1 deletion
Makefile
types.md
+69
-0
69 additions, 0 deletions
types.md
with
73 additions
and
1 deletion
Makefile
+
4
−
1
View file @
f0660703
...
...
@@ -29,7 +29,7 @@ REVEALOPRIONS += --self-contained
SVG
=
$(
wildcard figs/
*
.svg
)
PNG
=
$(
SVG:%.svg
=
%.png
)
all
:
$(PNG) intro.html variables.html
all
:
$(PNG) intro.html variables.html
types.html
figs/%.png
:
figs/%.svg
convert
\-
flatten
$<
$@
...
...
@@ -40,5 +40,8 @@ intro.html: intro.md Makefile
variables.html
:
variables.md Makefile
pandoc
-s
$(
REVEALOPRIONS
)
-o
$@
$<
types.html
:
types.md Makefile
pandoc
-s
$(
REVEALOPRIONS
)
-o
$@
$<
clean
:
rm
-rf
intro.html variables.html
This diff is collapsed.
Click to expand it.
types.md
0 → 100644
+
69
−
0
View file @
f0660703
---
title
:
Cours de programmation séquentielle
subtitle
:
Types
author
:
Orestis Malaspinas
<!-- date
:
25 avril 2018 -->
sansfont
:
Sans Serif
header-includes
:
<link rel="stylesheet" href="reveal.js/lib/css/zenburn.css" >
<link rel="stylesheet" href="reveal.js/css/theme/simple.css" id="theme">
<link rel="stylesheet" href="css/console.css" id="theme">
<script src="jquery/dist/jquery.min.js"></script>
<!-- <script src="reveal.js/lib/js/classList.js"></script> -->
<!-- <script src="reveal.js/plugin/zoom-js/zoom.js"></script> -->
<!-- <script src="reveal.js/plugin/highlight/highlight.js"></script> -->
<!-- <script src="js/remote-diagrams.js"></script> -->
<!-- <script src="reveal.js/plugin/notes/notes.js"></script> -->
include-after
:
<script src="js/playRust.js"></script>
<script src="js/remote-code.js"></script>
<script src="js/remote-diagrams.js"></script>
<script src="js/em-artiste.js"></script>
width
:
1500
height
:
1500
<!-- slide-numbers
:
true
-->
---
# Les types
## Les types en rust
-
Langage
**statiquement typé**
: tous les types sont connus
**à la compilation**
.
-
Les types sont
**inférés**
quand cela est possible.
-
Il est parfois nécessaire d'annoter le type explicitement.
<pre><code
data-trim=
"hljs rust"
class=
"lang-rust"
>
fn main() {
let x = 5; // entier 32 bits dont le type est inféré
let y:i32 = 5; // entier 32 bits dont le type est annoté
println!("Ces deux lignes sont équivalentes x est: {} et y est: {}", x, y); // affichage
}
</code></pre>
-
Il exits plusieurs types de base:
-
Les entiers.
-
Les nombres à virgule flottante.
-
Les booléens.
-
Les charactères.
## Les entiers
-
Il existe 4 tailles d'entiers (8, 16, 32, et 46 bits) qui viennent en signé ou non-signé.
+---------------+---------------+--------------------+
|Longueur | Signé | Non-signé |
+===============+===============+====================+
| 8 bits |
`i8`
{.rust} |
`u8`
{.rust} |
+---------------+---------------+--------------------+
| 16 bits |
`i16`
{.rust} |
`u16`
{.rust} |
+---------------+---------------+--------------------+
| 32 bits |
`i32`
{.rust} |
`u32`
{.rust} |
+---------------+---------------+--------------------+
| 64 bits |
`i64`
{.rust} |
`u64`
{.rust} |
+---------------+---------------+--------------------+
-
Également en taille dépendant de l'architecture
-
`isize`
{.rust} entier signé 32 ou 64 bits.
-
`usize`
{.rust} entier signé 32 ou 64 bits.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment