|
While I've got nothing as bad as that which has been posted, a colleague of mine was looking through some of my code and found something equivalent to this gem:code:
|
# ¿ Mar 21, 2008 21:22 |
|
|
# ¿ Apr 30, 2024 08:48 |
|
such a nice boy posted:What's wrong with that code? Is it just that Yes, that's why it was insane. I wanted to branch based on which number was higher (i.e., if(_a > _b) ). My code requires more work, breaks for cases where an argument is negative, and obviously relies on _b not being zero. That's why it was such a wtf for me. I don't even remember writing it, but source control doesn't lie.
|
# ¿ Mar 23, 2008 04:21 |
|
ashgromnies posted:(num & 1)==0 is correct. if( ((num-1) & (num)) == 0 ) is not a test for evenness, it's checking for if num is a power of two. It is however slightly incorrect in that zero is incorrectly considered to be a power of two, I think this can be used to fix that: if(!(num & (num - 1)) && num )
|
# ¿ Jun 4, 2008 07:09 |
|
BigRedDot posted: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. It was a savage optimisation.
|
# ¿ Aug 31, 2008 03:55 |
|
Hotels don't give a gently caress about reading input, pretending they do is a horror.
|
# ¿ Apr 16, 2010 23:31 |
|
Resisting speculative generality is great, but it's not an excuse for lazily writing bad code. public void register(String name, int room) public void register(Scanner scan) Which is easier to write unit tests for?
|
# ¿ Apr 16, 2010 23:41 |
|
Scaevolus posted:This is a horror. Inline your booleans!
|
# ¿ Dec 2, 2010 01:41 |
|
b0lt posted:
Can you (or someone who knows about ObjectiveC/C++ interop) explain the horror here as it looks reasonable to me but I am clueless about Objective C so...
|
# ¿ Jun 8, 2013 18:55 |
|
Pixelboy posted:I had a developer get pissy at me because I used the term "ex post facto" in a document. Why the gently caress would you?
|
# ¿ Aug 1, 2013 01:14 |
|
Is it seriously called pdo? Is it pronounced like pedo?
|
# ¿ Sep 23, 2013 22:19 |
|
Hammerite posted:It never occurred to me to read it that way. I always assumed it was pronounced "pee dee oh". I thought that was what it probably was, but I am very juvenile.
|
# ¿ Sep 23, 2013 22:35 |
|
Vanilla java is a joke these days man, surely nobody is making new java software outside of phone apps and maintenance.
|
# ¿ Oct 1, 2013 20:45 |
|
Bognar posted:Not if you're using it solely as an identifier. There are also some other strange things you could do with it in C# with extension methods. If you, for some reason, had functionality that could be used on any object (e.g. a GetHashCode() wrapper) but you only wanted it to appear on certain objects, you could have those objects inherit from an empty interface and define an extension method for that interface. Doing this totally sucks and is a pet hate of mine. "Marker" interfaces indeed; terrible. If you want a GetHashCode or a ToString on some interface, put it on the interface?
|
# ¿ Oct 18, 2013 17:06 |
|
crazypenguin posted:And the java one will print 3, and I'm not sure why anyone would think otherwise? I maybe have my retarded goggles on but why 3 - is Java method overloading weird?
|
# ¿ Oct 25, 2013 00:06 |
|
Kilson posted:Because you're passing in a B (not up-cast), so it should print 2? I think so too but dont really do much java
|
# ¿ Oct 25, 2013 00:17 |
|
The blog post from Bryan Cantrill at Joyent is absolutely ridiculous, and if he worked for me I can definitely say he would be *fired* right now for that poo poo (lack of sensitivity towards non-native English speakers on gendered pronouns, and for publicly castigating someone for executing an established procedure rather than reflecting on What Went Wrong).
return0 fucked around with this message at 19:14 on Dec 1, 2013 |
# ¿ Dec 1, 2013 19:10 |
|
pointsofdata posted:What's ridiculous about the blog post? It seems quite reasonable to me. It presumes that the maintainer who reverted the commit is familiar enough with English to comprehend the subtleties of gendered pronouns and the social implications of using them in the docs that they would (without instruction or communication) deviate from established commit acceptance protocol for documentation changes, which in a distributed FOSS community is disgustingly anglocentric. He then tries to publicly humiliate the guy in a cynical attempt to appear like he is a cool dude.
|
# ¿ Dec 1, 2013 19:20 |
|
pointsofdata posted:What's ridiculous about the blog post? It seems quite reasonable to me. It was Ben Noordhuis who reverted the commit, who is Dutch and not a native English speaker. He explains why he reverted it here https://github.com/joyent/libuv/pull/1015#issuecomment-29568172 I guess it's up to you if you think that Bryan Cantrill blog is a proportionate response, I don't and I think it's ridiculous?
|
# ¿ Dec 1, 2013 19:29 |
|
mjau posted:So he's not a native english speaker, yet he thought he was qualified to reject changes to the english documentation by someone who is? He probably thought he was qualified because it was his role on the project to enforce community standards, which this commit was in violation of? After it has all blown up it is very easy to say "well of course it's a good change and he should have accepted it" and apportion blame, but what if it was a random code change he was unfamiliar with that was committed out of line with the standard procedure, should he be responsible for finding an expert and verifying it (or was it the responsibility of the committer to explain the change, which it seems Isaacs did not do adequately)? It's absurd to blame this guy for correctly applying the established process just because the outcome is unpopular, and especially so for some dickhead to do so this dramatically on a public company blog (so it will appear in google from now on). Look Around You posted:"Fine, I'll just take my ball and go home" To take your ball home means nobody else gets your ball; people still have the project, they just don't get his contributions any more. I think that's pretty reasonable that he doesn't spend his free time contributing to a community that is happy to call him an rear end in a top hat for an obviously genuine mistake. return0 fucked around with this message at 21:15 on Dec 1, 2013 |
# ¿ Dec 1, 2013 21:10 |
|
Blinkz0rz posted:Definitely not. The reason that you are incorrect is that in a functional community, the community itself acts as a check and balance against improper applications of standard protocol. The maintainer reacted entirely reasonably to an out-of-band forced through commit that did not have proper authorisation, but then the community indicated to the maintainer that the change, while small, is significant. At this point the maintainer could then accept the commit. The problem is that the node community is apparently deeply dysfunctional and cynical, and people are so eager to self-aggrandise that they will post Internet tough-guy rhetoric about how they would totally fire this guy for his sexist attitude. No fucks seem to be given that the guy was just applying established norms, or that this reaction will leave a public trail of underserved invective about his character (despite him giving up his own time to be a core-maintainer), or that it makes the community itself look bad. Like seriously why is the guy a douche? Blinkz0rz posted:Of course, gender neutrality has no place in OSS. Nobody at all is saying this, you know this is an asinine strawman so why bother? The problem here is a bunch of people cynically riling up others to attack a guy who reverted a docs change, as he was compelled to by convention, because he didn't understand the significance of the content. This is very anglocentric (and possibly racist?). I don't think anyone is saying that the content of the change is bad in and of itself, it is better docs content; the problem is all the other poo poo. Like if this guy forced through a code commit and it fixed a bug but it was reverted as it jumped the queue, nobody would give a gently caress right? But because it's a docs issue (so everyone can understand it) and because it's a contentious issue, the guy becomes the villain. But it's the same in both cases; applying standards to your version control history. return0 fucked around with this message at 01:09 on Dec 2, 2013 |
# ¿ Dec 2, 2013 01:03 |
|
Blinkz0rz posted:Saying something is Anglocentric (and possibly racist?) is missing the point (because, you know, gender issues are an international concern) and is really doing a disservice to the actual issue at hand. The issue at hand is that Bryan Cantrill is cynically exploiting a community who care about gender equality by riling them up to abuse someone who made a genuine mistake (if you could call consistent application of the community policy a mistake!) for personal benefit.
|
# ¿ Dec 2, 2013 01:13 |
|
Blinkz0rz posted:This: It's not an apology because he doesn't owe an apology. The situation is that he rejected a commit that was, by the communities standards, pushed incorrectly. The commit, however, was good (in that it improved something), but it was reverted because it did not follow process (all commits should improve something but they can't all just be pushed immediately right?); note that the process does not require Ben to validate this rejection with a set of experts. Why does he owe an apology for this, and why are you so unwilling to accept that a non-native english speaker who was unaware of the reason for this (extra-process) commit might have reverted it in good faith? I guess I just don't understand the logic, when even by his own admission he volunteers in a mentorship program for young engineers to get involved in technology and volunteers as a core-maintainer on a popular project, why it is acceptable for rivals in that community to cynically exploit his actions and use them as a weapon in an ongoing power struggle between organisations in the node ecosystem. It trivialises the actual issue at hand, and taints the name of someone who is ostensibly innocent. It's such obvious and transparent politicking from Cantrill I'm surprised you're falling for it tbh
|
# ¿ Dec 2, 2013 03:04 |
|
Blinkz0rz posted:Who gives a flying gently caress about politicking in an open source project? The fact remains that Noordhuis was flippant about a PR that converted gendered pronouns to non-gendered pronouns and then, when he was called out on it, said "if it gets us scores of female contributors, who am I to object?" I don't think gendered pronouns are bad, they convey information that non gendered pronouns do not (specifically gender). I do think they are generally inappropriate for technical documentation and I agree with your broader point here. My problem is not with the commit, it's with people acting like Noordhuis was being a dick by reverting a rejected but pushed commit. I'm not surprised he's being called out, I just think he doesn't deserve it. I think you are well-meaning, but sheltered such that you don't understand how difficult it is to understand the subtleties in your non-native language, and lack the empathy to imagine what it would be like. I agree that it's pointless to continue arguing it, you've obviously made up your mind.
|
# ¿ Dec 2, 2013 03:25 |
|
shrughes posted:Okay, so, back to the topic of coding horrors... Are you deliberately trolling given the previous topic? http://jaxenter.com/my-code-is-so-bad-it-makes-people-s-eyes-bleed-46072.html / http://harthur.wordpress.com/2013/01/24/771/
|
# ¿ Dec 2, 2013 19:13 |
|
shrughes posted:No, it was a complete coincidence that I quoted verbatim two of the tweets. Cool just checking
|
# ¿ Dec 2, 2013 19:18 |
|
Jewel posted:I was confused about why "warning = limit * persentage" wouldn't work. I haven't worked with C++ in a little while so I thought "hm, does 'limit * persentage' create a new unsigned char of the multiplication, then cast that to long? I thought that makes sense so I did a quick test to see what the output would be. I got: Maybe it's C++ and operator * is overloaded and crashes?
|
# ¿ Jan 31, 2014 20:29 |
|
GrumpyDoctor posted:You can't overload operators unless one of the operands is a user-defined type. And it looks like the horror is meeeeeee! Only ever done/seen it for custom math types but didnt know it was illegal for built-in.
|
# ¿ Jan 31, 2014 23:16 |
|
ErIog posted:rolling your own bullshit untested nonsense The purpose of asking someone to reverse an array is to see if they can solve a trivial problem using an algorithm, because they might have to write code that isn't implemented in a library.
|
# ¿ Feb 3, 2014 15:05 |
|
coffeetable posted:No, that'd be the purpose of asking someone to reverse an array without using library functions. Okay, so imagine that as a result of asking that question you discover they can't reverse an array without a library function - is this useful information to you, as the interviewer, which you didn't have before? If so it's a worthwhile question, right?
|
# ¿ Feb 3, 2014 16:08 |
|
Ah okay, I understand what you are saying now, I thought you were insane and suggesting the question itself had no value rather than just ambiguous to the interviewee.
|
# ¿ Feb 3, 2014 16:40 |
|
shrughes posted:That is indeed an appropriate contribution for this thread, since it has undefined behavior on one of its inputs. Out of curiosity what's the UB?
|
# ¿ Feb 4, 2014 18:16 |
|
shrughes posted:You can see other circumstances where undefined behavior results in a surprise optimization, like seen http://lwn.net/Articles/342330/ <- there. This is pretty cool tbh
|
# ¿ Feb 5, 2014 01:07 |
|
Howmuch posted:I'm working on a big project at work and noticed a variation of this being used in the code in multiple places. How is this a horror at all?
|
# ¿ Mar 29, 2014 19:18 |
|
Sagacity posted:It's a horror because what previously could've been a simple call to DateTime.Now (or .UtcNow am I right?) now becomes an service/interface "look I have StructureMap" monstrosity. Hmm guess we'll just have to agree to disagree then
|
# ¿ Mar 31, 2014 19:42 |
|
I don't get why people hate the constructor. It's like, jeez just pass the stuff the class needs to the constructor already.
|
# ¿ Apr 1, 2014 07:13 |
|
It would be cool if a record scratch noise played in a meeting when people suggest using some GPL bullshit
|
# ¿ Apr 11, 2014 03:14 |
|
Jabor posted:Is this why people implement their own memory allocator because they think the platform one isn't fast enough? Usually people implement their own memory allocator for special cases where it is faster than an allocator that is fast for the general case, and where performance is important?
|
# ¿ Apr 19, 2014 15:51 |
|
Otto Skorzeny posted:I'm sorry your google-fu is weak - try the string "define t&a" and it will come up under the 4th result on the first page, or "t&a acronym" and it will come up under the second result on the first page Google for "define t&a" just brings up stuff about tits for me, and I search for technical things a lot, I think you are not correct.
|
# ¿ May 12, 2014 18:55 |
|
It's a pretty well known/obvious way to check a bit is set, not sure what the horror is tbh?
|
# ¿ May 24, 2014 22:59 |
|
|
# ¿ Apr 30, 2024 08:48 |
|
Zombywuf posted:The correct way to test a bit in C++ is obviously: why not just use value??
|
# ¿ May 25, 2014 18:15 |