From: tnp@invalid.invalid   
      
   On 05/02/2026 13:37, Lars Poulsen wrote:   
   > On 2026-02-04, Robert Riches wrote:   
   >> On 2026-02-04, c186282 wrote:   
   >>> On 2/3/26 23:18, Robert Riches wrote:   
   >>>> And, if I remember correctly from when I studied it a few years   
   >>>> ago some rather odd rules about when/how pointers can be passed   
   >>>> around. Sometimes, it takes a lot of gyrating to declare the   
   >>>> pointer in the right place to satisfy the "memory safety" rules.   
   >>>   
   >>> It's been a few years ... however I did download   
   >>> the Rust suite yesterday and will fool around   
   >>> with it some to see how it's come along and whether   
   >>> it's worth it.   
   >>>   
   >>> However my recollection was that if you can do   
   >>> it in Rust then you can do it with 'C' just as   
   >>> easily.   
   >>>   
   >>> "Safety" ... that always complicates things. Look   
   >>> into Ada, if you dare :-)   
   >>   
   >> Did a bit of web searching to refresh memory. The term is   
   >> "ownership":   
   >>   
   >> https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html   
   >>   
   >> https://luk6xff.github.io/other/safe_secure_rust_book/memory_   
   afety/pointers.html   
   >>   
   >> I didn't find exactly the wording I was looking for, but IIRC one   
   >> of the key issues is you cannot have a function that allocates   
   >> memory and returns a pointer to said allocated memory, because   
   >> that violates the rule from the first link that, "When the owner   
   >> goes out of scope, the value will be dropped." Largely, it's   
   >> that restriction that causes difficulty when some code is ported   
   >> from C to Rust. Workarounds to that restriction are required in   
   >> Rust that are not required in C.   
   >   
   > And that is EXACTLY why Rust is "safer" than C.   
   >   
   In the same way blunt plastic scissors are safer than a chainsaw.   
   --   
   No Apple devices were knowingly used in the preparation of this post.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|