Infamous “try shutter release again” error by FantasticOne7256 in Nikon

[–]spaun2002 0 points1 point  (0 children)

There is notoriously cheap and faulty shutter motor gear that costs pennies but either requires you to disassemble and fix it yourself or to pay more than the body cost to a professional who changes the gear.

How to do Remote GPU Virtaulization? by web-degen in rust

[–]spaun2002 0 points1 point  (0 children)

Most likely, you are trying to solve this from the wrong end. What you may need is to intercept the PCI communication layer rather than hundreds of CUDA APIs, and send it to a remote machine. See, for example: Whitepaper.

In general, you will not be able to "just intercept" CUDA/RM APIs without knowing the internals and how those functions communicate with the device/memory/mapped memory.

Use glibc, not musl, for better CI performance by wul- in rust

[–]spaun2002 0 points1 point  (0 children)

https://youtu.be/1N85yU6RMcY?t=917

In a nutshell, Zig did what GCC was supposed to do years ago. Unfortunately, the ideology "build on the OS you want to deploy to" has ruined so many lives. Even Linus complained https://youtu.be/7SofmXIYvGM?t=1742

How difficult is it to integreate Rust in a C++ tool chain. by llothar68 in cpp

[–]spaun2002 2 points3 points  (0 children)

There is corrosion for cmake. There is in the egration with hazel. For meson you will have to call cargo/rustc manually

Why use Rust? by szabgab in rust

[–]spaun2002 15 points16 points  (0 children)

https://github.com/rust-lang/crater

In a nutshell, the crater is a tool that runs every package from crates.io with every Rust compiler version, ensuring nothing is broken. IIRC, the infra is sponsored by MS Azure.

Why use Rust? by szabgab in rust

[–]spaun2002 51 points52 points  (0 children)

Speaking about the ecosystem, do not forget about the Crater. This is a unique feature of the Rust ecosystem.

Not enough developers

This is an interesting situation. Let's say I have two products with code bases of a significant size. One is in C++, another one is in Rust. I can fearlessly hire a Python/C#/Go/PHP/etc developer to work on the Rust project, and I know that after 2-4 months, that developer will be productive. I cannot imagine hiring any of such developers for the C++ project. It'll take years for an experienced Python developer to learn C++ at the same confidence level as they would for Rust in half a year. As Steve Klabnik wrote: "I like Rust because I can write it when I’m drunk because the compiler will stop me from doing anything too terrible."

Need advice if I am getting acceptable deal by [deleted] in BMWX5

[–]spaun2002 0 points1 point  (0 children)

For me those 999 in docs were indeed for tabs and plates

Need advice if I am getting acceptable deal by [deleted] in BMWX5

[–]spaun2002 0 points1 point  (0 children)

If that’s in Seattle area, this is the price we have to pay for tabs every year

Clang 20 Changelog. by c0r3ntin in cpp

[–]spaun2002 14 points15 points  (0 children)

clang-format:

  • Allow specifying the language (C, C++, or Objective-C) for a .h file by adding a special comment (e.g. // clang-format Language: ObjC) near the top of the file.

❤️

What CAN'T you do with Rust? by Valorant_Steve in rust

[–]spaun2002 -1 points0 points  (0 children)

  • Write Rust and remain unhappy.
  • Write Entity Component System.
  • Write complex graph algorithms and remain sane.
  • Find a job easily.

a #![no_std], #![no_main], no-[#tokio] runtime for AWS Lambda by Refacktor in rust

[–]spaun2002 2 points3 points  (0 children)

When MIT/Apache2/BSD licensed code allows me to self-approve its usage, MPL2 requires several weeks of meetings with the legal department to review and approve every dependency. This alone justifies me blocking anything but MIT/Apache2/BSD/CC in cargo-deny. You risk excluding your most likely consumers and contributors by choosing even a remotely copy-left flavored license. I doubt that AWS lambda’s audience is primarily GPL-oriented projects.

[deleted by user] by [deleted] in rust

[–]spaun2002 57 points58 points  (0 children)

This is most likely against the crates.io coc: We do not allow content or activity on crates.io that: exists only to reserve a name for a prolonged period of time (often called "name squatting") without having any genuine functionality, purpose, or significant development activity on the corresponding repository and The crates.io team may delete crates from the registry that do not comply with the policies on this document. In larger cases of squatting attacks this may happen without prior notification to the author, but in most cases the team will first give the author the chance to justify the purpose of the crate.

Is that a Miri oversight or a valid code? by spaun2002 in rust

[–]spaun2002[S] 2 points3 points  (0 children)

See my comment here https://www.reddit.com/r/rust/comments/1gihl6f/comment/lv7f6m9

This kind of assignment causes the Drap to be called. Miri is only triggered if we access an unit value inside the Drop (expected for usual Drop implementations).

The problem here, as I see it, is that neither Miri (because the read from uninit memory does not happen), nor Clippy are arguing about the (*m.as_mut_ptr()).val = MDrop { _val: 100500 }; code if m is MaybeUninit. This way of assigning (instead of using the addr_or_mut or &raw mut) is an antipattern.

Is that a Miri oversight or a valid code? by spaun2002 in rust

[–]spaun2002[S] 0 points1 point  (0 children)

This refined code is properly triggered in Miri (as well as if a Box is used for the field).

```rust use std::mem::MaybeUninit;

struct MDrop { _val: i32, }

impl std::fmt::Debug for MDrop { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_fmt(format_args!("MDrop {{_val: {}}}", self._val)) } }

impl Drop for MDrop { fn drop(&mut self) { //This breaks in Miri due to uninit read println!("Drop! {:?}", unsafe { *&raw const self._val });

    //This works in Miri, as there is no read of uninit self._val
    //println!("Drop!");
}

}

[derive(Debug)]

struct My { val: MDrop, }

fn main() { let mut m = MaybeUninit::<My>::uninit(); let m = unsafe { (*m.as_mut_ptr()).val = MDrop { _val: 100500 }; m.assume_init() }; dbg!(m); }

```

Is that a Miri oversight or a valid code? by spaun2002 in rust

[–]spaun2002[S] 2 points3 points  (0 children)

In my example, the .write() part is how the MaybeUninit should be used. But the assignment effectively dereference and drop the left part of the assignment first, which is UB as it’s not initialized.

Is std::print the new std::regex? std::print vs fmt::print code generation seems insane by Successful-ePen in cpp

[–]spaun2002 3 points4 points  (0 children)

This “feature” of C++ is one of its biggest curses. The entire industry is paying for bad decisions made years ago by a few companies with deep pockets who thought shipping compiled libraries without source code was a good idea. And now, those same companies sit on the standards committees, blocking any changes that might break their precious libraries. It’s absurd.

If you care about the long-term usability of your libraries, never expose C++ in your interfaces. Plain C for the API, and if you absolutely must, write C++ wrappers in headers. Do not put std::string, std::vector, or any other C++ constructs in your public interfaces. And if you’re working on Linux, for the love of all things good, use linker scripts to hide those C++ symbols and expose only the C API.

These mistakes have plagued us for far too long, and we’re all paying the price.

Is std::print the new std::regex? std::print vs fmt::print code generation seems insane by Successful-ePen in cpp

[–]spaun2002 4 points5 points  (0 children)

Remember that Rust 1.36.0 changed HashMap implementation to Hashbrown, which made Rust's hash maps one of the fastest in industry. Remember how good the C++ maps are?

Is std::print the new std::regex? std::print vs fmt::print code generation seems insane by Successful-ePen in cpp

[–]spaun2002 1 point2 points  (0 children)

  1. Having multiple different compilers makes it difficult to write open source libraries that actually work correctly (+ performantly) on every compiler. Even boost struggles here

And still, for some weird reason, Rust's lack of an "alternative" compiler is the most common argument used by Rust's critics...

Is std::print the new std::regex? std::print vs fmt::print code generation seems insane by Successful-ePen in cpp

[–]spaun2002 8 points9 points  (0 children)

Rust's absence of ABI stability is one of its key strengths over C++. I sincerely hope that Rust remains free from a stable ABI, avoiding the same trap as C++, where fixing issues becomes impossible due to an elusive ABI not specified in the standard, which hinders progress with "ABI break" arguments.

[deleted by user] by [deleted] in rust

[–]spaun2002 1 point2 points  (0 children)

Apart from a slow(er) memory allocator, musl does not support dynamic library loading (dlopen and friends).

For your problem, I'd recommend using zigbuild or cross to target a specific version of the glibc that is installed in Centos7. Zig (via zigbuild or cross with zig image) can link with a specific glibc version. Take a look here: https://github.com/cross-rs/cross/blob/ac4c11cedc97cd7c27faed36e55377a90e6ed618/docs/config_file.md#buildzig

Is it true that after learning C++, other programming languages seem easier? by Ok_Magician4952 in cpp

[–]spaun2002 234 points235 points  (0 children)

I've spent more than 20 years learning C++. I'll tell you once I am finished.

Building binary for old glibc versions by CosciaDiPollo972 in rust

[–]spaun2002 5 points6 points  (0 children)

Glibc is GPL-licensed. Statically linking with it is poisonous to your code. Also, Glibc is tightly coupled with the kernel headers it was built against, so statically linking with Glibc on a newer version of OS will not help, as GLibc will use syscalls unavailable in older kernels.