Comprehensive Rust(繁体中文)的幾個獨特賣點如下: 22 • 「編譯期的記憶體安全性」- 在編譯期間就能避免各類記憶體錯誤 – 不會產生未初始化的變數。 – 不會導致重複釋放記憶體。 – 不會使用已釋放的記憶體。 – 不會產生 NULL 指標。 – 不會產生忘記鎖定的互斥鎖。 – 執行緒之間不會發生資料競爭。 – 不會發生疊代器無效的情形。 • 「不會出現未定義的執行階段行為 (undefined runtime behavior)」- 照很像指標。在稍後的課程中,我們將介紹 Rust 如何避免使用原始指標導致的記憶體安全錯誤。 44 • Rust 不會自動為您建立參照,一律須使用 &。 • Rust will auto-dereference in some cases, in particular when invoking methods (try r.is_ascii()). There is no need for an – 如果允許的變體值未涵蓋所有位元模式,Rust 會使用無效的位元模式來編碼判別值 (即「區 位最佳化」)。舉例來說,Option<&u8> 可儲存指向整數的指標,也可儲存 None 變體適用的 NULL。 – 您可以視需要控制判別值,例如為了與 C 相容: enum Bar { A, // 0 B = 10000, C, // 10001 } fn main() { println!("A:0 码力 | 358 页 | 1.41 MB | 10 月前3
Julia 1.10.9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 27.15 Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 362 27.16 Thread-safety . . . . . . . . . julia> s2 = "1" "1" julia> pointer.([s1, s2], 1) 2-element Array{Ptr{UInt8},1}: Ptr{UInt8} @0x00000000132c9638 Ptr{UInt8} @0x0000000013dd3d18 julia> s1 = s2 "1" julia> pointer.([s1, s2], 1) 2-element are distinct types, even though they have identical representations. And of course, all specific pointer types are subtypes of the umbrella Ptr type: julia> Ptr{Float64} <: Ptr true julia> Ptr{Int64}0 码力 | 1692 页 | 6.34 MB | 3 月前3
julia 1.10.10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 27.15 Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 362 27.16 Thread-safety . . . . . . . . . julia> s2 = "1" "1" julia> pointer.([s1, s2], 1) 2-element Array{Ptr{UInt8},1}: Ptr{UInt8} @0x00000000132c9638 Ptr{UInt8} @0x0000000013dd3d18 julia> s1 = s2 "1" julia> pointer.([s1, s2], 1) 2-element are distinct types, even though they have identical representations. And of course, all specific pointer types are subtypes of the umbrella Ptr type: julia> Ptr{Float64} <: Ptr true julia> Ptr{Int64}0 码力 | 1692 页 | 6.34 MB | 3 月前3
Julia 1.11.4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 28.15 Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 28.16 Thread-safety . . . . . . . . . julia> s2 = "1" "1" julia> pointer.([s1, s2], 1) 2-element Array{Ptr{UInt8},1}: Ptr{UInt8} @0x00000000132c9638 Ptr{UInt8} @0x0000000013dd3d18 julia> s1 = s2 "1" julia> pointer.([s1, s2], 1) 2-element are distinct types, even though they have identical representations. And of course, all specific pointer types are subtypes of the umbrella Ptr type: julia> Ptr{Float64} <: Ptr true julia> Ptr{Int64}0 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.11.5 Documentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 28.15 Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 28.16 Thread-safety . . . . . . . . . julia> s2 = "1" "1" julia> pointer.([s1, s2], 1) 2-element Array{Ptr{UInt8},1}: Ptr{UInt8} @0x00000000132c9638 Ptr{UInt8} @0x0000000013dd3d18 julia> s1 = s2 "1" julia> pointer.([s1, s2], 1) 2-element are distinct types, even though they have identical representations. And of course, all specific pointer types are subtypes of the umbrella Ptr type: julia> Ptr{Float64} <: Ptr true julia> Ptr{Int64}0 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.11.6 Release Notes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 28.15 Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 28.16 Thread-safety . . . . . . . . . julia> s2 = "1" "1" julia> pointer.([s1, s2], 1) 2-element Array{Ptr{UInt8},1}: Ptr{UInt8} @0x00000000132c9638 Ptr{UInt8} @0x0000000013dd3d18 julia> s1 = s2 "1" julia> pointer.([s1, s2], 1) 2-element are distinct types, even though they have identical representations. And of course, all specific pointer types are subtypes of the umbrella Ptr type: julia> Ptr{Float64} <: Ptr true julia> Ptr{Int64}0 码力 | 2007 页 | 6.73 MB | 3 月前3
julia 1.13.0 DEV. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 28.15 Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 28.16 Thread-safety . . . . . . . . . are distinct types, even though they have identical representations. And of course, all specific pointer types are subtypes of the umbrella Ptr type: julia> Ptr{Float64} <: Ptr true julia> Ptr{Int64} AbstractFloat. Unlike with integer registers, where the size of Int reflects the size of a native pointer on that machine, the floating point register sizes are specified by the IEEE-754 standard.) Type0 码力 | 2058 页 | 7.45 MB | 3 月前3
Julia 1.12.0 RC1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 28.15 Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 28.16 Thread-safety . . . . . . . . . are distinct types, even though they have identical representations. And of course, all specific pointer types are subtypes of the umbrella Ptr type: julia> Ptr{Float64} <: Ptr true julia> Ptr{Int64} AbstractFloat. Unlike with integer registers, where the size of Int reflects the size of a native pointer on that machine, the floating point register sizes are specified by the IEEE-754 standard.) Type0 码力 | 2057 页 | 7.44 MB | 3 月前3
Julia 1.12.0 Beta4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 28.15 Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 28.16 Thread-safety . . . . . . . . . are distinct types, even though they have identical representations. And of course, all specific pointer types are subtypes of the umbrella Ptr type: julia> Ptr{Float64} <: Ptr true julia> Ptr{Int64} AbstractFloat. Unlike with integer registers, where the size of Int reflects the size of a native pointer on that machine, the floating point register sizes are specified by the IEEE-754 standard.) Type0 码力 | 2057 页 | 7.44 MB | 3 月前3
Julia 1.12.0 Beta3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 28.15 Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 28.16 Thread-safety . . . . . . . . . are distinct types, even though they have identical representations. And of course, all specific pointer types are subtypes of the umbrella Ptr type: julia> Ptr{Float64} <: Ptr true julia> Ptr{Int64} AbstractFloat. Unlike with integer registers, where the size of Int reflects the size of a native pointer on that machine, the floating point register sizes are specified by the IEEE-754 standard.) Type0 码力 | 2057 页 | 7.44 MB | 3 月前3
共 36 条
- 1
- 2
- 3
- 4













