 Comprehensive Rust(繁体中文)語言包含兩個部分: • **安全的 Rust:**可確保記憶體安全,無法觸發未定義的行為。 • **不安全的 Rust:**如果違反先決條件,便可能觸發未定義的行為。 We saw mostly safe Rust in this course, but it's important to know what Unsafe Rust is. 不安全的程式碼通常都很簡短、受到隔離,而且封裝在安全的抽象層中。您應該仔細記錄這類程式碼的正 mut s = String::from("careful!"); let r1 = &mut s as *mut String; let r2 = r1 as *const String; // Safe because r1 and r2 were obtained from references and so are // guaranteed to be non-null and properly { println!("r1 is: {}", *r1); *r1 = String::from("uhoh"); println!("r2 is: {}", *r2); } // NOT SAFE. DO NOT DO THIS. /* let r3: &String = unsafe { &*r1 }; drop(s); println!("r3 is: {}", *r3); */ }0 码力 | 358 页 | 1.41 MB | 10 月前3 Comprehensive Rust(繁体中文)語言包含兩個部分: • **安全的 Rust:**可確保記憶體安全,無法觸發未定義的行為。 • **不安全的 Rust:**如果違反先決條件,便可能觸發未定義的行為。 We saw mostly safe Rust in this course, but it's important to know what Unsafe Rust is. 不安全的程式碼通常都很簡短、受到隔離,而且封裝在安全的抽象層中。您應該仔細記錄這類程式碼的正 mut s = String::from("careful!"); let r1 = &mut s as *mut String; let r2 = r1 as *const String; // Safe because r1 and r2 were obtained from references and so are // guaranteed to be non-null and properly { println!("r1 is: {}", *r1); *r1 = String::from("uhoh"); println!("r2 is: {}", *r2); } // NOT SAFE. DO NOT DO THIS. /* let r3: &String = unsafe { &*r1 }; drop(s); println!("r3 is: {}", *r3); */ }0 码力 | 358 页 | 1.41 MB | 10 月前3
 julia 1.13.0 DEVTask Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 25.9 Safe use of Finalizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 26 Multi-processing since convert can be called implicitly, its methods are restricted to cases that are considered "safe" or "unsurprising". convert will only convert between types that repre- sent the same basic kind Finally, it takes account of changes in any compile-time preferences. If you know that a module is not safe to precompile (for example, for one of the reasons described below), you should put __precompile__(false)0 码力 | 2058 页 | 7.45 MB | 3 月前3 julia 1.13.0 DEVTask Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 25.9 Safe use of Finalizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 26 Multi-processing since convert can be called implicitly, its methods are restricted to cases that are considered "safe" or "unsurprising". convert will only convert between types that repre- sent the same basic kind Finally, it takes account of changes in any compile-time preferences. If you know that a module is not safe to precompile (for example, for one of the reasons described below), you should put __precompile__(false)0 码力 | 2058 页 | 7.45 MB | 3 月前3
 Julia 1.12.0 RC1Task Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 25.9 Safe use of Finalizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 26 Multi-processing since convert can be called implicitly, its methods are restricted to cases that are considered "safe" or "unsurprising". convert will only convert between types that repre- sent the same basic kind Finally, it takes account of changes in any compile-time preferences. If you know that a module is not safe to precompile (for example, for one of the reasons described below), you should put __precompile__(false)0 码力 | 2057 页 | 7.44 MB | 3 月前3 Julia 1.12.0 RC1Task Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 25.9 Safe use of Finalizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 26 Multi-processing since convert can be called implicitly, its methods are restricted to cases that are considered "safe" or "unsurprising". convert will only convert between types that repre- sent the same basic kind Finally, it takes account of changes in any compile-time preferences. If you know that a module is not safe to precompile (for example, for one of the reasons described below), you should put __precompile__(false)0 码力 | 2057 页 | 7.44 MB | 3 月前3
 Julia 1.12.0 Beta4Task Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 25.9 Safe use of Finalizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 26 Multi-processing since convert can be called implicitly, its methods are restricted to cases that are considered "safe" or "unsurprising". convert will only convert between types that repre- sent the same basic kind Finally, it takes account of changes in any compile-time preferences. If you know that a module is not safe to precompile (for example, for one of the reasons described below), you should put __precompile__(false)0 码力 | 2057 页 | 7.44 MB | 3 月前3 Julia 1.12.0 Beta4Task Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 25.9 Safe use of Finalizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 26 Multi-processing since convert can be called implicitly, its methods are restricted to cases that are considered "safe" or "unsurprising". convert will only convert between types that repre- sent the same basic kind Finally, it takes account of changes in any compile-time preferences. If you know that a module is not safe to precompile (for example, for one of the reasons described below), you should put __precompile__(false)0 码力 | 2057 页 | 7.44 MB | 3 月前3
 Julia 1.12.0 Beta3Task Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 25.9 Safe use of Finalizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 26 Multi-processing since convert can be called implicitly, its methods are restricted to cases that are considered "safe" or "unsurprising". convert will only convert between types that repre- sent the same basic kind Finally, it takes account of changes in any compile-time preferences. If you know that a module is not safe to precompile (for example, for one of the reasons described below), you should put __precompile__(false)0 码力 | 2057 页 | 7.44 MB | 3 月前3 Julia 1.12.0 Beta3Task Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 25.9 Safe use of Finalizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 26 Multi-processing since convert can be called implicitly, its methods are restricted to cases that are considered "safe" or "unsurprising". convert will only convert between types that repre- sent the same basic kind Finally, it takes account of changes in any compile-time preferences. If you know that a module is not safe to precompile (for example, for one of the reasons described below), you should put __precompile__(false)0 码力 | 2057 页 | 7.44 MB | 3 月前3
 julia 1.10.10Task Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 24.11 Safe use of Finalizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 25 Multi-processing since convert can be called implicitly, its methods are restricted to cases that are considered "safe" or "unsurprising". convert will only convert between types that repre- sent the same basic kind Finally, it takes account of changes in any compile-time preferences. If you know that a module is not safe to precompile (for example, for one of the reasons described below), you should put __precompile__(false)0 码力 | 1692 页 | 6.34 MB | 3 月前3 julia 1.10.10Task Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 24.11 Safe use of Finalizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 25 Multi-processing since convert can be called implicitly, its methods are restricted to cases that are considered "safe" or "unsurprising". convert will only convert between types that repre- sent the same basic kind Finally, it takes account of changes in any compile-time preferences. If you know that a module is not safe to precompile (for example, for one of the reasons described below), you should put __precompile__(false)0 码力 | 1692 页 | 6.34 MB | 3 月前3
 Julia 1.11.6 Release NotesTask Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 25.9 Safe use of Finalizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 26 Multi-processing since convert can be called implicitly, its methods are restricted to cases that are considered "safe" or "unsurprising". convert will only convert between types that repre- sent the same basic kind Finally, it takes account of changes in any compile-time preferences. If you know that a module is not safe to precompile (for example, for one of the reasons described below), you should put __precompile__(false)0 码力 | 2007 页 | 6.73 MB | 3 月前3 Julia 1.11.6 Release NotesTask Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 25.9 Safe use of Finalizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 26 Multi-processing since convert can be called implicitly, its methods are restricted to cases that are considered "safe" or "unsurprising". convert will only convert between types that repre- sent the same basic kind Finally, it takes account of changes in any compile-time preferences. If you know that a module is not safe to precompile (for example, for one of the reasons described below), you should put __precompile__(false)0 码力 | 2007 页 | 6.73 MB | 3 月前3
 julia 1.12.0 beta1Task Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 25.9 Safe use of Finalizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 26 Multi-processing since convert can be called implicitly, its methods are restricted to cases that are considered "safe" or "unsurprising". convert will only convert between types that repre- sent the same basic kind Finally, it takes account of changes in any compile-time preferences. If you know that a module is not safe to precompile (for example, for one of the reasons described below), you should put __precompile__(false)0 码力 | 2047 页 | 7.41 MB | 3 月前3 julia 1.12.0 beta1Task Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 25.9 Safe use of Finalizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 26 Multi-processing since convert can be called implicitly, its methods are restricted to cases that are considered "safe" or "unsurprising". convert will only convert between types that repre- sent the same basic kind Finally, it takes account of changes in any compile-time preferences. If you know that a module is not safe to precompile (for example, for one of the reasons described below), you should put __precompile__(false)0 码力 | 2047 页 | 7.41 MB | 3 月前3
 Julia 1.10.9Task Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 24.11 Safe use of Finalizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 25 Multi-processing since convert can be called implicitly, its methods are restricted to cases that are considered "safe" or "unsurprising". convert will only convert between types that repre- sent the same basic kind Finally, it takes account of changes in any compile-time preferences. If you know that a module is not safe to precompile (for example, for one of the reasons described below), you should put __precompile__(false)0 码力 | 1692 页 | 6.34 MB | 3 月前3 Julia 1.10.9Task Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 24.11 Safe use of Finalizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 25 Multi-processing since convert can be called implicitly, its methods are restricted to cases that are considered "safe" or "unsurprising". convert will only convert between types that repre- sent the same basic kind Finally, it takes account of changes in any compile-time preferences. If you know that a module is not safe to precompile (for example, for one of the reasons described below), you should put __precompile__(false)0 码力 | 1692 页 | 6.34 MB | 3 月前3
 Julia 1.11.4Task Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 25.9 Safe use of Finalizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 26 Multi-processing since convert can be called implicitly, its methods are restricted to cases that are considered "safe" or "unsurprising". convert will only convert between types that repre- sent the same basic kind Finally, it takes account of changes in any compile-time preferences. If you know that a module is not safe to precompile (for example, for one of the reasons described below), you should put __precompile__(false)0 码力 | 2007 页 | 6.73 MB | 3 月前3 Julia 1.11.4Task Migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 25.9 Safe use of Finalizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 26 Multi-processing since convert can be called implicitly, its methods are restricted to cases that are considered "safe" or "unsurprising". convert will only convert between types that repre- sent the same basic kind Finally, it takes account of changes in any compile-time preferences. If you know that a module is not safe to precompile (for example, for one of the reasons described below), you should put __precompile__(false)0 码力 | 2007 页 | 6.73 MB | 3 月前3
共 21 条
- 1
- 2
- 3













