Skip to content

Instantly share code, notes, and snippets.

Avatar

Ahmed Abdelfattah aabdelfattah

View GitHub Profile
@aabdelfattah
aabdelfattah / Rust Linux kernel development Environment
Last active Jan 18, 2023
Setting up an environment for Rust Linux kernel development
View Rust Linux kernel development Environment
#
# Instructions for the video https://www.youtube.com/watch?v=tPs1uRqOnlk excluding setting up the env ( e.g. installing Rust and llvm)
#
#
# Kernel
#
$ git clone --depth=1 https://github.com/Rust-for-Linux/linux.git
View move.cpp
class Obj {
...
//move constructor
Obj(const Obj&& other){
..
}
//move assignment operator
Obj& operator= (const Obj&& other){
..
}
View copy.cpp
class Obj {
//default constructor
Obj(int size){
..
}
//copy constructor
Obj(const Obj& other){
..
}
//assignment operator
View rvalue.cpp
string getName() {
string str = "medium";
return s;
}
// getName() returns an rvalue
string&& name = getName();
View assignment.cpp
string str = "medium";
@aabdelfattah
aabdelfattah / call-by-ref.py
Last active Jun 4, 2019
python pass object reference by value
View call-by-ref.py
def modify(arg):
arg += [1]
l = [2]
modify(l)
print(l) # >> [2, 1]
@aabdelfattah
aabdelfattah / call-by-value.py
Last active Jun 4, 2019
python pass object reference by value
View call-by-value.py
def modify(arg):
arg = 'hard'
str = 'medium'
modify(str)
print(str) # >> medium
@aabdelfattah
aabdelfattah / assignment.py
Last active Jun 4, 2019
object assignment
View assignment.py
str = 'medium'