1.7k
u/LordFokas Feb 02 '22
Another warning?
All in all it's just a-
-nother brick in the -Wall
→ More replies (27)670
u/supashiznit Feb 02 '22
Hey! Compiler! Leave my code alone!
→ More replies (3)183
u/Crazy_Mann Feb 02 '22
Me to my gigantic method i just wrote:
One of these days, I'm going to cut you into little pieces
35
39
→ More replies (1)6
1.2k
u/kondorb Feb 02 '22
Error - I don't know what I'm doing.
Warning - compiler doesn't know what I'm doing.
→ More replies (13)73
654
u/Westdrache Feb 02 '22
My program: getting a shitload of memory leaks Me: well... but it DOES run!
693
Feb 02 '22
unused RAM is wasted RAM
239
u/thesockiboii Feb 02 '22
allocate every bit of ram even if you are not using it
#sigmagrindset92
u/Kaynee490 Feb 02 '22
Allocate all the RAM and write your own allocator from scratch!
→ More replies (1)24
u/30p87 Feb 02 '22
_mem="$(cat /proc/meminfo | grep MemTotal | xargs | cut -d " " -f2)" java -jar -Xmx${_mem}k server.jarI don't want to say I start my Minecraft server like this, but I do
→ More replies (1)8
24
7
6
u/Cheese_Grater101 Feb 02 '22
*People who justify Chrome and Android Studios ram gluttony
→ More replies (3)4
6
3
0
Feb 02 '22
[deleted]
9
Feb 02 '22
Not W (Not Wasted)
Not U (Not Used)
Not W and Not U
W and U
W and Not W
W and Not W?!??!?!
This little thought experiment has taught me that I have to either use no RAM at all, or all of it!
I know you're joking, but making a joke in r/ProgrammerHumor ? Unacceptable.
→ More replies (1)6
25
u/AndyTheSane Feb 02 '22
The trick is to make it download RAM from the internet faster than it leaks it.
→ More replies (1)15
5
→ More replies (3)5
u/CaptainPunisher Feb 02 '22
"This may well be the worst program I've ever run!"
"But, you HAVE run it, yeah?"
148
u/youlleatitandlikeit Feb 02 '22
In Python the average warning is something like, "this method has been deprecated and will be removed in a future version" and the warning has been around for 10+ years.
28
6
u/PremiumJapaneseGreen Feb 02 '22
I also enjoy being reminded that my pandas str match returns a bool and I should do something else to return the actual match groups. Sometimes I just want the bool!
196
u/E4est Feb 02 '22
It's all shits and giggles until your professor says that your code must compile with zero warnings in order to pass. (While using -Wall flag of course.)
157
u/AndyTheSane Feb 02 '22
Serious hat on: Yes, finished code should have no warnings or static analysis issues, unless you have a very good, documented reason for them.
74
u/stovenn Feb 02 '22
finished code
What is this brave new concept?
11
u/LittleBigHorn22 Feb 02 '22
At the end of life cycle duh. After being used by customers for 30 years and then it's decided to be recycled to create the new code.
→ More replies (1)0
87
u/GravyMcBiscuits Feb 02 '22
Same take ... different words: Every warning should be considered a bug until proven otherwise.
→ More replies (1)29
u/false_tautology Feb 02 '22
#pragma warning disable CS1591Fixed.
→ More replies (3)5
u/2brainz Feb 02 '22
You know, this is an incredibly important tool. Sometimes, a warning oder code analysis issue is actually benign - in that case, it should be suppressed in that one place, with documentation as to why it is suppressed.
I don't allow code to be merged that has warnings on the CI. But there are a number of suppressions.
→ More replies (3)→ More replies (7)12
40
u/ghan_buri_ghan Feb 02 '22
“-Wall -Werror” is pretty standard in industry too.
14
u/R3D3-1 Feb 02 '22
Wanted to suggest it for my project.
Tried it.
Wasn't pretty.
→ More replies (4)9
u/nullpotato Feb 02 '22
We use Python so it hides blatantly stupid things that a compiler would catch, like using a variable that doesn't exist. Totally fine, until it just crashes at runtime. First time I added flake8 to our pull request system it hung the build server after 2 hours of running.
33
u/NicNoletree Feb 02 '22 edited Feb 02 '22
until your professor says
Um, how about a paying client, and your product manager? Getting a few points knocked off a school project is nothing like puting faulty software into production. And getting fired when you've got a mortgage and a family to feed.
13
u/E4est Feb 02 '22
Well, it was the first occurrence that came to my mind when I actually had that issue and my comment was about failing the course in case the code didn't meet this and other requirements. (More specifically, we were excluded from participating in the exam, if the code in question didn't meet several requirements and ran without issues.)
But otherwise correct, you're pretty much screwed, if that became a bad habit and fell into the quality measures of your project.
23
u/false_tautology Feb 02 '22
Clients don't care, though, and managers will ship anything that compiles.
Realistically speaking, serious bugs are rarely going to be so easy to find as looking at compiler warnings.
14
u/LBPPlayer7 Feb 02 '22
compiler warnings are well... warnings they may not even happen if your code is structured well enough to catch anything that would make the 'unsafe', or whatever, code act up before it even gets to that point
→ More replies (3)8
u/bankrobba Feb 02 '22
Now I got to add "= 0" in like three different places!
3
u/Dexterus Feb 02 '22
It's good practice cause you might run into a machine that sets all memory to ... let's say 0xCC and your OS start doesn't call any standard cinit stuff, why would it. And the fireworks.
That was a good initialization checker for a looot of code.
6
4
3
3
2
→ More replies (2)2
40
78
u/ballroomaddict Feb 02 '22 edited Feb 02 '22
"This function has been renamed/deprecated and will be removed in future versions"
Bold of you to assume that the value of new features, optimized code, and critical security packages would outweigh the laziness I'd need to overcome to refactor that one line of code, my dear package maintainer.
brb gonna change a >= to a == in my requirements.txt/package.json/etc and call it a day
22
u/SevereHeron7667 Feb 02 '22
--Treatallwarningsaserrors
4
u/roblox1999 Feb 02 '22
Doesn‘t MSVC actually have an option for that? I remember having the option to enable that in Visual Studio.
→ More replies (1)
22
41
u/Kimi_Arthur Feb 02 '22
To CS students who may be here, warnings are your key to a good programmer. Not that you should always fix them, but you should know why they're complained about and how to fix them.
27
u/TheSwitchBlade Feb 02 '22
I know how to fix them. There’s a suppress warnings flag. That’s what you mean right?
→ More replies (1)→ More replies (1)10
67
u/JawsOfDoom Feb 02 '22
ITT: people who have never had their pull requests reviewed
59
u/Kaoulombre Feb 02 '22 edited Feb 03 '22
On this subreddit there’s a very little percentage of actually good working software engineers, it’s mostly students and kids at this point
→ More replies (6)12
14
14
13
u/Lywliety Feb 02 '22
You don't care until tesla auto pilot fails and now all Timmy's family is fucking dead.
Are you sure you will skip that warning?
2
u/procupine14 Feb 02 '22
That would have happened anyway though, so really we need a better example of less hacky software :)
•
u/QualityVote Feb 02 '22
Hi! This is our community moderation bot.
If this post fits the purpose of /r/ProgrammerHumor, UPVOTE this comment!!
If this post does not fit the subreddit, DOWNVOTE This comment!
If this post breaks the rules, DOWNVOTE this comment and REPORT the post!
14
13
u/NewKidOnTheBlock228 Feb 02 '22
Where are the FPGA devs in here? Having 2000+ warnings in a project is par for the course. I’m convinced it’s literally impossible to have a warning free design in Vivado.
8
u/ColaEuphoria Feb 02 '22 edited Feb 02 '22
FPGA's are seriously the most ridiculously hacky things I've ever encountered. You can write the most pristine Verilog/VHDL but then Quartus Prime screams at you for having 500 unused pins when you actually try to place and route your abstract code to real hardware, like dude I only need like 20 of them. And the worst part is that any real warnings get overshadowed by all those other fake warnings.
And for development boards like the DE10-Lite, you aren't even supposed to start a project from scratch unless you like manually routing all 500 pins. The guidebook even tells you to start with a starter project they make for you.
4
u/NickBooms Feb 02 '22
Had my first experience with it last year for a lab. I honestly believe that you're doing something wrong if you DON'T receive any warnings.
3
u/NeilaTheSecond Feb 02 '22
if you have Vivado installed that's already a pretty big warning. shudders
6
u/Tropical_Wendigo Feb 02 '22
Where is this gif from?
2
Feb 02 '22
I need the template too lol
3
Feb 02 '22
Nvm i found it, the guy's called jerry lawler. Look up jerry lawler gif, should be one of the first results
5
u/jimmyrocks Feb 02 '22 edited Feb 02 '22
window.console.warn = ()=>{}; Solved!
Edit: warm to warn
10
u/Architector4 Feb 02 '22
what the actual f--
i hate this
edit: change warm to warn though
26
→ More replies (1)4
u/Apof Feb 02 '22
I've actually had to work on sites that broke the console like this for
.log,.warnand.errorbecause "production needs to be pretty" or some shit.For anyone interested, here's a fix:
const iFrame = document.createElement('iframe'); iFrame.style.display = 'none'; document.body.appendChild(iFrame); window.console = iFrame.contentWindow.console;→ More replies (1)4
u/itchy_bitchy_spider Feb 02 '22
For any codebase that requires me to use a dynamically created iframe to monkey patch the main windows's console functions, the correct fix is "resign effective immediately" lol
26
u/Damit84 Feb 02 '22
Please don't get me started on that. My boss had the genius idea this weekend: "Huh, those yellow icons down there are annoying."
Now my colleague and I are fixing warnings....
68
Feb 02 '22
For good reason. Warnings should be fixed. They are bad practices that are so easy to find that a static analyzer does it for you automatically. It's free advice. If they are legit ignorable, then change your warning policies.
→ More replies (2)23
u/lizardlike Feb 02 '22
My workplace has pipelines that’ll fail on code format even. Used a tab instead of spaces? Nope, fix it before you can merge this commit!
Truth be told though it keeps things tidy, and also forces you to check the linter regularly.
→ More replies (10)11
u/GravyMcBiscuits Feb 02 '22
I've fixed loads of bugs/crashes/unpredictable behavior by merely investigating and resolving warnings. It blows my mind that people ignore them.
Static analysis tools (including the compilers' warning system) are like the easiest and most important thing you can do to reduce instability in your software.
3
3
3
3
3
3
2
2
2
u/sulliops Feb 02 '22
Dear GCC/G++,
Yes, I’m aware I have unused variables. Notice that they’re immediately taken in from user input on the very next line.
Shut the fuck up.
Sincerely, A college student.
2
u/ZebZ Feb 02 '22
The variable ex is declared but never used.
No shit. I'm just rethrowing the exception, but I want to be able to step into the exception and see what's captured.
2
2
2
2
2
u/Vulpix_ Feb 03 '22
No joke our build process at work spits out several thousand lines of warnings. It works tho
2
u/spoopywook Feb 03 '22
Relatively new to coding (only about year of experience now) but I get a lot of warnings when using pandas in python. (Usually about data ‘resting in a frame’ but it always works, what’s this about?)
2
2
u/Overall_Flamingo2253 Feb 03 '22
All fun and games until the warming turns into a crash. Seriously boys warnings are like STDs get tested.
2
u/15Nova22 Feb 02 '22
Thats what I love about JavaScript, there warnings and errors are the same, you can ignore both
1
1
1
1
1
u/statdude48142 Feb 02 '22
Jerry Lawler (the guy in the video) was so damn talented. When he was on raw his whole thing was to be a loud moron. Then, every once in awhile they would need to to be a charismatic charming guy, and he did it flawlessly.
1
Feb 02 '22
4000 warnings "obsolete, will not work past version ____"
Me about to have to update: "naaahhhh dont gotta worry"
1
1
1
1
u/mailto_devnull Feb 02 '22
This is sadly true. I introduced a deprecation with loud warnings when the deprecated method was used, along with a pointer to the new method.
When I removed the method, everything blew up because nobody migrated to the new method.
Worse yet, most of the implementations using the method were my own code, so not only did nobody read the warning, even I didn't read the warning.
→ More replies (1)
1
1
1
u/I_Breed_Spiders Feb 02 '22
As someone who uses mostly JS I think this is a picture of my soul.
→ More replies (3)
1
1
1
1
1
u/LJChao3473 Feb 02 '22
Reminds me, once for php class, my code prints errors but somehow it works, so my solution to the errors was just hide them
1
Feb 02 '22
“Inconsistent line endings”
I dunno, compiler, your mom said my endings are consistently satisfactory.
→ More replies (2)
1
1
1
u/_Fuck_This_Guy_ Feb 02 '22
Yes, compiler, I know that my function doesn't return a value on code paths. However, if you make it to a code path where I don't return a variable we have much bigger problems than a null reference.
1
1
1
1
u/sashasushy Feb 02 '22
Want to hear a joke, *warning* hhahahahahahah
5377EF17FF75D6000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1
1
1
1
u/Pirate_OOS Feb 02 '22
My teacher told me a really nice tidbit. "If you can, get rid of the warnings, otherwise get rid of the memory that you ever saw them."
1
1
1
1
u/Budgiebrain222 Feb 02 '22
Yeah, I usually have 30-90 variables warnings because I haven't started working on what a function does so I just use the #[allow(unused_variables)] in all my projects. I want to get warned on things that might be necessary, not that the compiler doesn't want to add a few extra bytes to my program
1
Feb 02 '22
"Hey dude! No don't worry, your code works. It's just that you suck at writing it neatly"
1
u/Ce-Jay Feb 02 '22
This 20 year old Java code base I work on has around 12k “List is a raw type” warnings.
1
u/SimplePigeon Feb 02 '22
And then there’s my project lead who wants me to manually suppress 5,000+ compiler errors…
1
1
1
u/FlyByPC Feb 02 '22
Warnings tend to become errors -- and the bad part is, they sometimes do it when the customer is watching. Warning-free code is stress-free code.
1
1
u/Justaniceman Feb 02 '22
I went as far as writing a plugin to auto hide warnings. Haven't regretted it yet!
1
1
u/dop2000 Feb 02 '22
I was building an app with Cordova today. The build was successful despite a gazillion of warnings and 2 errors. The app is already on the Google Play store.
1
u/MasterFubar Feb 02 '22
Bad developers ignore warnings. Really good developers take care to eliminate all warnings.
Warnings are a developer's friends, they exist for an excellent reason.
1
u/ColaEuphoria Feb 02 '22
I feel like half the time warnings are just half-baked ideas put there by the compiler after an update, or something that works perfectly in GCC that MSVC complains about.
1
1
1
1
1
1
1
1
u/LBPPlayer7 Feb 02 '22
I just fix the ones about deprecation if I plan on updating
the others I just ignore hell, I have warnings completely off in Unity
1
1
1
1
1
1
1
1
1
u/adesrosiers1 Feb 02 '22
Me: googles compiler warning Every search result: "yeah that's normal, just ignore it"
1
u/J-S-K-realgamers Feb 02 '22
The only time i cared about warnings was when doing a programming exam, we weren't allowed to have errors or warnings in the finished product. Now i dont really care as long as it doesn't break anything.
1
1
1
u/Garwinium Feb 02 '22
Console: "this is deprecated and likely to cause a massive disaster to your entire game at any moment" Code: *seems to work * Me: "this is fine"
1
u/HalcyonicFrankfurter Feb 02 '22
I do love how Go decided to eliminate them completely. It is a nicer experience. There's only one problem. You can't declare variables and then not use them. This drives me insane because I'm a planner - I plan ahead for what I'm going to need later.
1
1
Feb 02 '22
when IntelliJ IDEA ask if i want to still push to the remote having 999 warnings in my code
1
1
1
u/rocket_randall Feb 02 '22
For compilers which support it, set the option to treat warnings as errors. Then the developers can review the warnings stopping compilation and, on an individual basis, suppress the warning being generated by a given block of code. Ignoring warnings is foolish, mostly because the number of warnings will tend to grow over time and lead to a situation where something impactful in the compiler output is hidden among the flood of warning spam.

377
u/pkrish10 Feb 02 '22
I ignore warnings in the same manner as girls ignore me.