|
JoeNotCharles posted:That's NINE copies of the core "save" code, and EIGHTEEN of the sendFileUpdatedMessage call. And yes, there was one change in one of the copies which I can't account for. From the other end of the spectrum (bigger code block, but repeated few times) I recall some code from a physicist office mate once that had one 3000 line block of code repeated five times in a row—just with what amounted to a loop iteration variable changing everywhere in each block.
|
# ¿ Aug 31, 2008 03:17 |
|
|
# ¿ Apr 19, 2024 20:23 |
|
floWenoL posted:The person who wrote the code may be completely familiar with the function, but maybe not the person reading the code later. code:
Anyway I did just recently finally concede a situation where reference return parameters were more useful than not (to me anyway), so I can't make a blanket admonition. I got tired of writing the the little snippets of code to read values out of text entry widgets all over the place, and having a stable of separate GetFloat, GetUnsigned, GetDouble, GetChar, GetInt, GetWhatever, ... functions annoys the hell out of me (other people at work do this in other situations, and that's also a coding horror to me). So I use: code:
|
# ¿ Sep 1, 2008 18:26 |
|
floWenoL posted:I don't get why you can't use T *val here.
|
# ¿ Sep 2, 2008 01:06 |
|
floWenoL posted:No it doesn't. That's silly. Look, I'd love to have explicitly labeled output parameters too. And in the absence of such, I almost always think it's better to not use reference parameters as output parameters. But I'm not going to uphold a convention "just because" in the cases where it doesn't make sense. If I allow T* then what are the cases. I can 1) never check for NULL, and fail ungraciously if someone happens to pass it in, and I try to write to it. That just won't fly, at least not on the product I develop. So I am left with 2) checking for NULL every single time. Apart from just being irksome in the "why do I have to do this completely unnecessary thing" sense, it's also not so good in that although I can return failure, the real reason for the failure (a NULL pointer that should have never been passed in, as opposed to a failure of lexical_cast) is not immediately evident. Or, in a trivial function with a blatantly obvious name and explicit supporting documentation I can allow a reference output parameter and not have to worry about any of the above because it's not even possible in the first place.
|
# ¿ Sep 2, 2008 01:28 |
|
Seriously, what is attempting to iterate past the end of a sequence, if not an exceptional circumstance?
|
# ¿ Nov 8, 2008 18:06 |
|
You forgot to mention that it took three people to craft that gem.
|
# ¿ Feb 27, 2009 22:59 |
|
quote:An attacker could, for example, use it to download privilege escalating malware (one of the many reasons your server should never execute wget...)
|
# ¿ Feb 28, 2009 07:56 |
|
bouyancy posted:Exactly but what is worse is that in Java the ResultSet throws an exception if you try to read from a column that wasn't selected in the query. So if you use this on a query that only selects a couple columns then it will throw and catch about three hundred exceptions for each row returned.
|
# ¿ Apr 1, 2009 16:26 |
|
In all fairness though, one person who wrote some of that code will freely admit that he is not a programmer, and that he doesn't particularly want to program or know why he is occasionally tasked to do so when it's not really part of his job. The real horror is that we hire so many non-programmers to do programming. BigRedDot fucked around with this message at 05:51 on Jun 3, 2009 |
# ¿ Jun 3, 2009 05:48 |
|
Inverse Icarus posted:I've heard a lot of this from people who don't work for high-tech companies. A lot of non-CS and non-Math majors end up coding, and that scares the hell out of me. BigRedDot fucked around with this message at 06:28 on Jun 3, 2009 |
# ¿ Jun 3, 2009 06:26 |
|
Flobbster posted:I don't think I've ever seen more obvious proof that Larry Wall is just trolling the entire programming language community with Perl. There's no other explanation for the poo poo that goes on there. code:
|
# ¿ Jun 15, 2009 19:15 |
|
plushpuffin posted:No testing or validation or review whatsoever beyond what the programmer felt like doing at the time. So I don't work for Lockheed Martin, but I have to work with Lockheed Martin. Let me summarize their approach to testing/debugging: quote:Reboot until it sort of works, then the problem never existed.
|
# ¿ Jul 5, 2009 09:25 |
|
gibbed posted:This is nitpicking and platform specific, although the cerr thing is stupid, yes.
|
# ¿ Jul 8, 2009 03:19 |
|
sex offendin Link posted:There is no generalized way to byte-swap IEEE 754 numbers anywhere, they are for all intents and purposes non-portable.
|
# ¿ Jul 8, 2009 03:46 |
|
RussianManiac posted:what C compiler doesn't support function prototypes, and how would that macro help? Do you mean so they can change it to a function pointer? code:
|
# ¿ Jul 9, 2009 06:55 |
|
sensual donkey punching posted:code like this gives me great pleasure. reminds me of the ever popular pastime of writing unnecessary forth interpreters
|
# ¿ Jul 10, 2009 04:41 |
|
Lexical Unit posted:Haha, same file: We both know this particular developer's sins can never be erased.
|
# ¿ Jul 23, 2009 21:58 |
|
Dijkstracula posted:s/business//
|
# ¿ Aug 1, 2009 18:16 |
|
Please you've got to stop. Between that and the find you wrote up on my whiteboard earlier today, I am going to lose all hope.
|
# ¿ Aug 19, 2009 21:16 |
|
Lexical Unit posted:So that pretty much describes my boss Which is especially ironic considering the utter shite that he produces. Having to use, interface to, or otherwise deal with his code is like a millstone about my neck. BigRedDot fucked around with this message at 20:10 on Sep 3, 2009 |
# ¿ Sep 3, 2009 20:07 |
|
Zombywuf posted:This is the closest I've seen to managing to parody timecube. However it still falls short. Is it actually possible to parody it? Timecube is invariant under parody operations.
|
# ¿ Sep 6, 2009 14:03 |
|
Lexical Unit posted:
BigRedDot fucked around with this message at 15:49 on Sep 29, 2009 |
# ¿ Sep 29, 2009 15:46 |
|
Fecotourist posted:Simulated annealing? By any chance did the assembler documentation mention a "temperature schedule"? I fail to believe anyone would have done this except perhaps out of spite or as an attempt at humor.
|
# ¿ Nov 5, 2009 18:59 |
|
spotted today:code:
|
# ¿ Nov 6, 2009 20:29 |
|
Mr Dog posted:O(1/2 n) Also an unaigned int is what you get when you have to type that much crap by hand because the dev box is airgapped.
|
# ¿ Nov 7, 2009 00:57 |
|
Mustach posted:So maybe there's a barrel underneath this barrel.
|
# ¿ Nov 10, 2009 15:23 |
|
I guess we've just run out of coding horrors then?
|
# ¿ Nov 29, 2009 18:44 |
|
Mustach posted:There is a 100% chance that if someone structures their code like that, they are sick in the head.
|
# ¿ Dec 2, 2009 16:04 |
|
Fib posted:This is a little gem of a horror Your tax dollars buy only the best.
|
# ¿ Dec 10, 2009 17:38 |
|
RussianManiac posted:Is it possible to pass code that is not either of those 3 values? could you pass an arbitrary integer instead of something of type Code?
|
# ¿ Jan 6, 2010 22:23 |
|
GrumpyDoctor posted:I get a kind of goofy future-proofing vibe from it, as though the author was worried about people adding other possible Code values but wanted to make sure this component ignored them. I see it in code where I work, but we often cast integral values that are gotten over sockets or read from hardware registers into enums. It's a "just in case the sender can't be trusted" sort of thing. Of course that code is still a horror, since the switch is worthless.
|
# ¿ Jan 7, 2010 01:07 |
|
TRex EaterofCars posted:That has to be programming by permutation. I refuse to believe anyone deliberately writes code like that.
|
# ¿ Jan 25, 2010 19:49 |
|
Janin posted:Where I work, none of the builds use -Wall because "it prints too much noise".
|
# ¿ Feb 8, 2010 15:00 |
|
Avenging Dentist posted:Get a Buildbot and a person who hates the color orange and gradually add -Whatever options to the Buildbot. Edit: zombywuf I want to hug you
|
# ¿ Feb 8, 2010 15:52 |
|
Avenging Dentist posted:Could be worse. You could be using autotools. BigRedDot fucked around with this message at 19:41 on Feb 8, 2010 |
# ¿ Feb 8, 2010 19:35 |
|
ZorbaTHut posted:I was working with an annoying C library a while back that defined its own FALSE and TRUE constants. I wanted to use those names on my own, so I ended up with quote:Another technique is to make TRUE and FALSE have the same value, though most would consider that out and out cheating. Using values 1 and 2 or -1 and 0 is a more subtle way to trip people up and still look respectable.
|
# ¿ Feb 10, 2010 14:46 |
|
Zombywuf posted:So yeah, what time it actually is at the time of the event you're interested in. That's the major complication with financial dealings. What you want it is accurate time series data with no drop-outs. But that's not what the real world provides. Sometimes the event you care about (a price usually), at the time you are interested, simply does not exist. Financial data is very, very dirty. By contrast, your planes always land, one way, or another.
|
# ¿ Feb 15, 2010 14:53 |
|
The person that wrote this has been fired, sure, but that's meager consolation when I stumble across all the droppings he left. This was buried under a few levels of indentation, in the middle of a giant switch, in a 900 line function. I've preserved the formatting also for your enjoyment.code:
BigRedDot fucked around with this message at 00:33 on Mar 30, 2010 |
# ¿ Mar 29, 2010 21:40 |
|
More irredeemable code today (approximated):code:
code:
BTW if you are a US citizen your tax dollars paid for this.
|
# ¿ Mar 31, 2010 20:40 |
|
|
# ¿ Apr 19, 2024 20:23 |
|
Otto Skorzeny posted:(from the source code of pidgin, in gtkimhtml.c) Also, the pidgin devs are arrogant dicks.
|
# ¿ Apr 11, 2010 07:25 |