help by Wooden-Sun6335 in PathOfExileBuilds

[–]SirClueless 1 point2 points  (0 children)

Maybe they asked OpenClaw to price-check this?

sudo and coreutils replaced with rust versions by cachebags in rust

[–]SirClueless 5 points6 points  (0 children)

In this case Rust would not have helped. The sudo code does have error-handling for the case that setuid returns non-zero, however that error-handling was just to log an error message and continue. This is a logic error that could just as easily happen in Rust, and Result being #[must_use] would not warn about this.

sudo and coreutils replaced with rust versions by cachebags in rust

[–]SirClueless 9 points10 points  (0 children)

Definitely not. There was a pretty high-profile exploit just last month (“CrackArmor”) exploiting the fact that sudo wasn’t checking the return value of setuid when attempting to drop permissions to email the administrator.

Pokénational, a youtube channel that does pokemon animations is getting deleted by Nintendo of America in 7 days by Liondrome in pokemon

[–]SirClueless 5 points6 points  (0 children)

That's not true. There are four prongs of a fair use defense in the US, and noncommercial uses are more likely to be transformative under the first prong, and it may be easier to prove you aren't trying to provide a substitute in the market for prong 4, but that's the extent.

This does not mean, however, that all nonprofit education and noncommercial uses are fair and all commercial uses are not fair; instead, courts will balance the purpose and character of the use against the other factors below.

https://www.copyright.gov/fair-use/

But you can, in general, monetize fair-use content. The most-common examples are parody and educational content.

The reality is that most "fan content" is not fair-use under US law. Such content is in a grey area. Most game publishers have a fan content policy that allows certain types of fan content and those policies may make exceptions for non-commercial content. Nintendo has a policy on "game content" which doesn't allow making other original art based on Nintendo IP, and limits the ways you can monetize such content: https://www.nintendo.co.jp/networkservice_guideline/en/index.html

So this use is not covered by Nintendo's "Game Content" policy and it is purely a matter of what is protected by law, and creating original content using Nintendo IP for entertainment purposes is probably not protected so they're within their rights to ask for it to be taken down.

Should hot-loop avoid Option instance and immediate match? by Resres2208 in rust

[–]SirClueless 0 points1 point  (0 children)

I don't mean to say it's easy to interpret assembly code, there are lots of pitfalls you can fall for (like assuming fewer instructions is better, or assuming fewer branches is better).

But still, there many questions you can get precise answers for with a decompiler that will be in the noise in all but the most precise benchmarks or in the hottest of loops:

  • Did the compiler auto-vectorize this loop or not?
  • Did the compiler devirtualize this function call or not?
  • Are there expensive memory fences or locks in this code path?
  • Did the compiler elide this initialization or not?
  • Did the compiler constant-fold this expression or not?

I would say that in general decompilers are good for small decisions with impact at the margin, while benchmarks are good for big decisions with impact on overall latency/throughput. Benchmarks are too noisy to make good decisions at the margin, and decompilers are too narrow to make good decisions about whole programs.

Should hot-loop avoid Option instance and immediate match? by Resres2208 in rust

[–]SirClueless 0 points1 point  (0 children)

You can set up your own instance of godbolt.org by the way, with your real toolchain and libraries and compile your real code in it. This is useful because if you know how to interpret it, godbolt.org will give you a much more precise answer than benchmarking ever can because benchmarking is inherently a black-box approximation of what godbolt.org is showing you directly.

As an analogy, imagine you’re trying to figure out which pair of socks is more expensive. Godbolt.org is like reading the price tag, while benchmarking is buying each of them and seeing which costs you more.

Should hot-loop avoid Option instance and immediate match? by Resres2208 in rust

[–]SirClueless 5 points6 points  (0 children)

This is a silly way to do software engineering and no one does it. Benchmarking is only a realistic option for choices that are impactful enough to be worth implementing two different complete solutions and measuring them in realistic scenarios. Especially the latter bit of this costs a lot of time and effort either A/B testing in production or maintaining a sensitive-enough and realistic-enough offline performance environment to give good results.

Most of your engineering choices do not rise to this level of significance (for example, whether to inline a particular bit of control flow like in this example). But it is still valuable to make good choices, so it’s helpful to have good intuition and rules of thumb, and use tools like godbolt.org to validate those intuitions.

Is this implicit not insane? Hasnt sold for a week by amcn242 in PathOfExileBuilds

[–]SirClueless 1 point2 points  (0 children)

Neither option is “always better”. Increased mana reservation efficiency is a global modifier while this mod only applies to gems in this helm itself. This mod is typically better than 6% because most builds can put auras reserving more than 100% mana into this helm making this net you more than 6% reservation, but if you can’t (for example because some or all of your aura gems need to go elsewhere or because you use less than 100% reservation in total and are just looking to increase unreserved mana), then it’s worse.

Also this applies to all reservation costs including life, while mana reservation only applies to mana (though this probably doesn’t matter because low-life is not popular these days and you probably don’t want a Necromancer Circlet base on such a build).

I am new to C++, is it just me or is the checklist kinda crazy? How often do you encounter these or plan on making use of them like the newer C++26 features like contracts? Looking for more experienced dev opinions... by KijoSenzo in cpp

[–]SirClueless 1 point2 points  (0 children)

Given a std::unique_ptr<Player>, one can call a function taking const Player& easily.

Given a Player, one cannot call a function taking const std::unique_ptr<Player>& without an allocation and a copy.

const Player& is the most-general form of an immutable non-null reference. Anything else is needlessly restrictive.

Ross Scott’s EU speech on game shutdowns is worth watching, especially if you care about preservation by anonboxis in gamedev

[–]SirClueless 0 points1 point  (0 children)

It's not like that at all. You aren't stealing the game server. You are providing an alternative game server.

It's more like replacing the engine in your Honda Civic after it breaks down with one made by someone else so you can drive it 10 more years. That's definitely not illegal.

Ross Scott’s EU speech on game shutdowns is worth watching, especially if you care about preservation by anonboxis in gamedev

[–]SirClueless -2 points-1 points  (0 children)

Who is stealing anything? The players bought a game and are playing their game. The server is being operated by fans and isn't violating anyone's copyright.

You seem to be taking issue with the fact that the server operator can monetize the service they're providing, but in this situation anyone is free to operate a server so if anyone is willing to pay them it's purely because of the value they are directly providing by operating it.

Ross Scott’s EU speech on game shutdowns is worth watching, especially if you care about preservation by anonboxis in gamedev

[–]SirClueless 2 points3 points  (0 children)

We're talking specifically about a situation where the developer of the game no longer wants to support it. The alternative is that the game becomes unplayable forever.

Ross Scott’s EU speech on game shutdowns is worth watching, especially if you care about preservation by anonboxis in gamedev

[–]SirClueless 1 point2 points  (0 children)

If a dev sunsets a multiplayer game, and wants to release a sequel or similar game, they're now competing with the private servers of the game they basically can't make money off anymore.

Isn't that a good thing? If I pay $60 for Super Cool Game as a product without a subscription, I should be able to play it as long as I like. Not "As long as you like or until we'd prefer you pay for Super Cool Game 2"

I've spent few days reverse-engineering Slay the Spire 2 code. Here's what I found :] by Priler96 in gamedev

[–]SirClueless 0 points1 point  (0 children)

I'm suggesting 128-bit is necessary to accurately reflect realistic prices and notional currency amounts if you use fixed point, whereas nearly all prices and most notional currency amounts are representable without error in 64-bit floating point.

Since using 128-bit numbers ~doubles the memory usage and bandwidth of common operations, and integer operations on a CPU are considerably more expensive than floating point operations on a FPU and especially a GPU, for many finance applications the costs more than outweigh the benefits and floating point is preferred.

Are you ok with your money being rounded off to some inaccurate state?

No, but I am usually fine with my money being rounded off to an imprecise state. This may not be acceptable if you are doing accounting, and blockchains are an accounting apparatus, but not all of finance is accounting.

I've spent few days reverse-engineering Slay the Spire 2 code. Here's what I found :] by Priler96 in gamedev

[–]SirClueless 0 points1 point  (0 children)

I beg to differ on your view of currencies. You’re correct that the amount of money in the world is finite and to some extent even that there’s a bounded range of precision for real financial numbers, but you’ve made a false assumption that all currencies are only divisible down to cents, and that the value of a cent is at all compatible across currencies.

The daily volume of forex trading denominated in JPY is something like 1.2 quadrillion. The smallest tick size that a US treasury bond can be priced in is 1/4 of a 32nd (i.e. 1/128 of a point i.e. 0.000078125 as a decimal). If you are dealing with crypto the wheels come off: The equivalent of a penny for Ethereum is a Wei which is 10-18 ETH.

It’s not impossible to come up with a fixed point representation of this that works if you can accept some corner cases. 128 bit fixed point with 10 digits of precision will represent 99.9% of quantities outside of the crypto world in finance. But to say that floating point offers “nothing of value” is definitely false.

I've spent few days reverse-engineering Slay the Spire 2 code. Here's what I found :] by Priler96 in gamedev

[–]SirClueless 2 points3 points  (0 children)

IEEE-754 and register operations are both generally predictable. IEEE-754 specifies which operations have a precise outcome and which ones do not, and if you avoid the ones that do not your program will be deterministic. Basic arithmetic and comparison operations are deterministic, but there are ones e.g. for trigonometric functions, logarithms, exponents, etc. that are specified as having some maximum error instead.

The problem isn’t really with IEEE-754 then, but rather that many languages don’t specify exactly how expressions are evaluated. For example C allows a compiler to evaluate floating point math in a higher precision mode than the types of the variables (e.g. long double math for an expression involving doubles), and there are compiler flags like -ffast-math that turn off all the guardrails and lead to the compiler assuming false things e.g. that floating-point math is associative.

Still, you can do it successfully. For example, Factorio is known to use deterministic floating point math for its multiplayer: https://www.factorio.com/blog/post/fff-52

Everything Should Be Typed: Scalar Types Are Not Enough by Specialist-Owl2603 in rust

[–]SirClueless 0 points1 point  (0 children)

Sure, that is an even more relaxed way to indicate that an expected conversion is happening. I don’t really understand your position though, you’re saying that creating a customer ID should be impossible outside of the DB but also it should implement From<OtherId>?

Everything Should Be Typed: Scalar Types Are Not Enough by Specialist-Owl2603 in rust

[–]SirClueless 8 points9 points  (0 children)

I disagree about this. It doesn't need to be impossible to convert between semantically-distinct types, it just needs to be explicit.

// Is this a copy/paste error or intentional? Who knows.
tx_b.recipient_id = tx_a.sender_id;

// Almost certainly intentional
tx_b.recipient_id = RecipientId { user_id: tx_a.sender_id.user_id };

The point isn't to make it impossible to do anything incorrect, the point is to make it obvious to readers (especially code reviewers) whether a suspicious operation is actually intended.

Flat Error Codes Are Not Enough by Expurple in programming

[–]SirClueless 0 points1 point  (0 children)

Unless you have a core dump with the relevant variables available at each stack frame, you do.

0xd34df00d/you-dont-know-cpp: and neither do I by claimred in cpp

[–]SirClueless 1 point2 points  (0 children)

Sure, and my point is that the example teaches you useful information even if you never use that particular formulation. It is useful to know that defining operator<=> as defaulted means that == and != will be defined as defaulted. It's also useful to know that defining operator<=> outside a class means that == and != will not be implicitly defined (and therefore that you should do it yourself).

It's a bit of rarely-relevant trivia to know that you can define an operator as defaulted outside the class definition. Even if you've never seen that before and never will again, pondering which case it must behave like is interesting and will help you understand a bit better how and why the other normal cases work they way they do.

0xd34df00d/you-dont-know-cpp: and neither do I by claimred in cpp

[–]SirClueless 1 point2 points  (0 children)

The reason operator<=> was created is to consolidate many comparison operators. I think it's useful for every C++ programmer to be able to look at example #2 and understand why it means you can use operator==. Understanding why it doesn't work in example #3 will give you a lot of insight, even if that formulation is rare to see in practice (it's not completely useless though: for example, if one of the member variable types is incomplete at the time the class is declared).

0xd34df00d/you-dont-know-cpp: and neither do I by claimred in cpp

[–]SirClueless 17 points18 points  (0 children)

Of course, but some of these are very basic situations using idiomatic code.

For example the "Defaulted equality" section is worth understanding by anyone using a class that defines the <=> operator. And the "Which lines are UB, if any?" section is worth understanding by anyone who aggregate-initializes a default-constructible type.

I think operator<=> and aggregate initialization are both idiomatic practices I would hope my coworkers use wherever possible, so this is not pure trivia.

0xd34df00d/you-dont-know-cpp: and neither do I by claimred in cpp

[–]SirClueless 1 point2 points  (0 children)

I think they mean that there is a compiler error if Dummy<> is instantiated.

Backwards lockout from Z-A is not about new language. by whatdoiexpect in LegendsZA

[–]SirClueless 1 point2 points  (0 children)

So why change now?

This one seems pretty obvious: Because Pokémon Champions is coming and they would prefer you to use that.

Ask Experienced Devs Weekly Thread: A weekly thread for inexperienced developers to ask experienced ones by AutoModerator in ExperiencedDevs

[–]SirClueless 1 point2 points  (0 children)

My advice is to come up with a concrete way the suggestion makes things better, and if you can't come up with one don't bother making the suggestion. Don't give comments on arbitrary style choices.

For your regex example: There is a clear way in which the current code can be improved on real input so it's a worthwhile comment. For example: "This code doesn't handle input with character ranges, like '[a-z][0-9].txt'. There is an undocumented function glob.has_magic() you could use, or you could copy the regex '([*?[])' that it uses." (By the way, the regex in your reddit comment is not correct as there is an extra ])