Answer the question
In order to leave comments, you need to log in
Weird Rust design?
I write if anything on the pluses, I recently tried Rust.
Design impressions are strange.
First, why are pointers called references in Rust?
A reference is an alias for a variable.
But in Rust, links take an address and work like pointers in pluses:
let var: i32 = 1;
let link: &i32 = & var; // &var - адрес var? Это ссылка или указатель?
println! ("{}", *link); // Ссылка с оператором разыменования?
let pointer: *const i32 = &var as *const i32;
unsafe { println! ("{}", *pointer); }
int *const a=nullptr; // константный указатель
let a: *const i32; // указатель на константу
Answer the question
In order to leave comments, you need to log in
Rust is not C++. Why does he have to take terms from C++?
In Java, too, references are pointers in C++ terminology.
Moreover, a reference differs from a pointer only in abstraction. In memory, these will be the same cells containing the address.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question