Conclusion
Copy semantics VS move semantics
| Languages | Paradigm |
|---|---|
| C | copy semantics + pointers |
| C++ | copy semantics by default + move semantics possible + pointers |
| Rust | move semantics by default + copy possible if mentionned + pointers |
| Python | pointers only |
In C, C++, assignments in general make copies by default.
x = y;`
Such a small instruction can be very cooooostly!
In Rust, assignments make move by defaut:
x = y;
//impossible to use `y` anymore!
except for types that implement the Copy trait, e.g. integers:
y = 5;
x = y;
//still possible to use `y`
In Python, variables are pointers!
x = y:
Memory managements
| Languages | Data location |
|---|---|
| C | stack & heap |
| C++ | stack & heap |
| Rust | stack & heap |
| Python/Java/Javascript etc. | Pointers to data in the heap |
| Languages | Paradigm |
|---|---|
| C | do it yourself |
| C++ | do it yourself + RAII encouraged |
| Rust | RAII |
| Python/Java/Javascript etc. | Garbage collection |
Type systems
| Languages | Paradigm |
|---|---|
| C | weak, static, no genericity |
| C++ | strong, static |
| Rust | strong, static + lifetime |
| Python | strong, dynamic (+ static gradual typing) |
I hope...
- that the C part will be useful for you in the architecture & system course in L3S2!
- that the Python part will be useful for you in the compiler course in M1S1!
- that you understand more C and Python for agregation
- that you are more fluent in programming languages for:
- your internship
- your research and/or teach
r career!
Happy christmas!