News for hackers. Stuff that matters.

Michael-F-Bryan

Re:Rust FFI: Sending strings to the outside world on Thursday May 18, 2017 @03:34AM (#14365465)
I'd recommend against using `std::mem::forget`. Even though it does pretty much the same thing you should probably use `some_cstring.into_raw()` instead. Semantically it's indicating that you are passing ownership of the string to the caller, while `forget()` just indicates that you want to leak the thing.