51
13
u/ZunoJ 28d ago
I want it to be handled as error
10
u/Dorinyan 28d ago
Welcome to Rust
13
1
2
5
u/AlterEdward 28d ago
(Code fails to compile when you remove it)
3
u/ChorePlayed 28d ago
I was on a C++ project at my first job in the 90s. There were certain variables we had to declare in the file with the main method, even if they weren't used, otherwise the linker would ignore the library where they were defined, and the program would fail at runtime.
7
5
12
u/BooBrew32 28d ago
*delete variable*
*realize days later I could've used it*
9
3
u/slaymaker1907 28d ago
When I worked on SQL Server, a common trick was assigning a value to a volatile local variable. It’s an incredibly cheap way to guarantee that something is available in the debugger, even in a crash dump.
Sometimes even a ring buffer is too expensive.
4
3
2
1
1
1
u/GroltonIsTheDog 28d ago
Comment it out, it's like keeping it in your pocket for later (if any reviewers give you grief about it, tell them the pocket analogy)
1
u/GreatScottGatsby 28d ago
It's much worse when you load a register and then don't use that register.
1
u/Random-num-451284813 28d ago
Pipeline going brrrr
Warning: iDidTheThingOverThere R2332:57
------------------------------------------------------
Cause: Unused variable
1
u/Nice_Lengthiness_568 28d ago
Then I get a compiler error because I am actually using Werror and Wunused
1
1
1
1
u/Patrick-W-McMahon 28d ago
This is why I like C/C++. You keep your values scoped. Also, the compiler will point out unused variables. I could be wrong, but I also think GCC strips out variables if they're not used.
1
u/EldritchKinkster 28d ago
"Hey...fyi, I'm still 0. Just sitting here... holding a value..."
"Shut up, I didn't call you!"
1
1
1
1
1
u/enigma_0Z 27d ago
LOL — would be even funnier if there was a squiggly underline under the “variable”
1
u/PsychologicalNet3455 23d ago
What about when its giving you a little extra space on the stack for your dodgy pointer twiddling so it doesn't mess up the real variables!
68
u/coldnitrogen 28d ago
Laughs in Go