Bad naming practice. CheckSuck implies it only checks and returns the result. Everything the function does should be included in the name to avoid confusion. Call it SuckIfUnsucked or something
That was my first reaction as well. Even if you say you can see that it doesn’t return a bool it’s still ambiguus as to what (if anything) happens when the state is sucked/unsucked. I would also prefer a name like GuranteeSucked or EnsureIsSucked.
bruh why is
unsucked
a global variablealso that function shouldn’t be named
Check
if it does things other than checking (e.g. sucking)RWIIR!!!
edit: here, I did it for you:
use std::*; static mut sucked: bool = false; fn main() { unsafe { check_sucked(); } println!("Kris has been sucked is {}", sucked) } unsafe fn check_sucked() { if !sucked { suck(); } } fn suck() { sucked = true; }
edit 2: fixed it
const mut…
I like to live
unsafe
If you made it static, sure, but right now you’re living compiler error
oh well, I’m just starting to learn the language and come from java, so I thought: wait, it can’t be static
const is more like C++ constexpr, but static is similar to static from C: it’s a variable that lives outside any scope. Of course, that means the same static can be accessed by multiple threads, so writing to a static is unsafe (except for types like Mutex, you can safely use those to write, but your static won’t be declared mut)
I personally would have matched the
sucked
… Maybe printed some lovely message about being content or somezhin
Who uses PascalCase for function names
C#
Why would you want to make things that are good suck? 🤨
I tried to make blowjob videos that don’t suck, but nobody wanted to watch them.
“OK class, tonight read the chapter on enshittification.”
How to make a suckless.org contributor cry
hakita my beloved
Jojo fan program
Kirby, is that you?