Illusive gently caress Man posted:is there some gcc flag I can add so when he writes unreadable garbage like this, it won't compile? or am i the idiot for not being able to understand this at a glance? This is the funniest thing I've read in this thread. I'm not entirely sure why, but the idea of this type of petty sabotage is hilarious to me. I actually laughed out loud at the thought of the poor bastard's confusion when gcc starts choking on his perfectly-fine-until-then code.
|
|
# ? Oct 29, 2014 02:35 |
|
|
# ? Apr 20, 2024 03:43 |
|
You just have to enable -Wunreadable-code. Maybe -Why for good measure.
|
# ? Oct 29, 2014 02:38 |
|
Jewel posted:You just have to enable -Wunreadable-code. Maybe -Why for good measure. The warning flag "hy" must be the sibling to the ruby library "ubygems".
|
# ? Oct 29, 2014 02:59 |
|
-fno-garbageJewel posted:-Why
|
# ? Oct 29, 2014 02:59 |
|
Just compile it with -Ofast
|
# ? Oct 29, 2014 03:34 |
|
When people in later pages complain about how this thread isn't funny anymore I am going to direct them to this page.
|
# ? Oct 29, 2014 03:36 |
|
hackbunny is a golden god.
|
# ? Oct 29, 2014 05:30 |
|
Centripetal Horse posted:This is the funniest thing I've read in this thread. I'm not entirely sure why, but the idea of this type of petty sabotage is hilarious to me. I actually laughed out loud at the thought of the poor bastard's confusion when gcc starts choking on his perfectly-fine-until-then code. Get parasoft and enable all the rules and it's pretty much the same thing.
|
# ? Oct 29, 2014 06:31 |
|
Would -Why explain the reasoning and justification behind obscure pieces of code? If it does I'd like to apply it to this if-statement (named changed slightly):C# code:
|
# ? Oct 29, 2014 09:47 |
|
Suspicious Dish posted:Window menus are kernel objects and are rendered in kernel mode.
|
# ? Oct 29, 2014 11:40 |
|
PrBacterio posted:Wait, is that actually true? The WndProc's for the WinAPI's builtin window classes run in kernel mode? Why on earth would they do that, I would have expected that to just live somewhere in Win32.dll or thereabouts Or is it ONLY the menus that do that, while, say, a listbox or button still runs in userland, as you would expect. But that would make even less sense, because why then isn't that also the case for menus. Large parts of the Windows UI runs inside the kernel because the performance implications of constantly mode-switching was a real concern back when it was first written. History has proven it to be a pretty big mistake, but it's a very difficult thing to actually fix.
|
# ? Oct 29, 2014 12:56 |
|
Harik posted:That's some ugly-rear end workarounds for type punning, I think. I've played games like that when dealing with structured data on the wire, but I try to isolate it to a single function that's very clearly unpacking a char* buf into a C-struct. oh, i know what it's supposed to be doing, and it is actually doing it correctly. It's just annoying because whenever I'm debugging and I see code like this I have to double check that this is true. It's actually a multi-horror. This is part of a library to communicate through shared memory with a piece of hardware. Somebody wired up a fpga backwards or some poo poo, so we have to bitwise reverse every byte. Also we have to swap the endianness of each 4 byte word. Why he didn't just use be32toh() for the second part, I don't know. Here's the whole function. C code:
Jewel posted:-Why I think "TODO clean up all code" says it all. i'm 80% sure that padding poo poo is never used. i feel like this whole function could be replaced with C code:
Illusive Fuck Man fucked around with this message at 14:43 on Oct 29, 2014 |
# ? Oct 29, 2014 13:21 |
|
LOOK I AM A TURTLE posted:Would -Why explain the reasoning and justification behind obscure pieces of code? If it does I'd like to apply it to this if-statement (named changed slightly): I don't know of any way to automagically explain or simplify that condition, but provided C# doesn't have any weirdness, it's equivalent to: C# code:
|
# ? Oct 29, 2014 13:41 |
|
qntm posted:I don't know of any way to automagically explain or simplify that condition, but provided C# doesn't have any weirdness, it's equivalent to: Hey, nice! That actually makes some sort of sense now.
|
# ? Oct 29, 2014 13:58 |
|
uuugggh i just realized everything is worse than i thought and he's literally reversing the endianness of everything the cpu sends to the microcontroller, even if it doesn't need reversing. The things that didn't need reversing in the first place are then reversed again in the code he wrote for the microcontroller. Also this is all done in a completely non-architecture safe way, which is a problem because this code will at some point need to run on different architectures. with most of the operations it's literally: cpu reverses every 4 bytes of a string of bytes and sends to microcontroller. microcontroller reverses every 4 bytes of input and does stuff microcontroller reverses every 4 bytes of output and sends back to cpu. cpu reverses every 4 bytes of the output. when we release, people are going to see this code. what the gently caress
|
# ? Oct 29, 2014 16:12 |
|
qntm posted:I don't know of any way to automagically explain or simplify that condition, but provided C# doesn't have any weirdness, it's equivalent to: A tool that did such simplification automatically would print money.
|
# ? Oct 29, 2014 16:14 |
|
Subjunctive posted:A tool that did such simplification automatically would print money. ReSharper does that in the .NET world, and yes, it prints money. [edit] Okay, it doesn't handle that particular monstrosity. But in general it can simplify expressions. New Yorp New Yorp fucked around with this message at 16:25 on Oct 29, 2014 |
# ? Oct 29, 2014 16:16 |
|
Ithaqua posted:ReSharper does that in the .NET world, and yes, it prints money. I suppose it would be dangerous to do the rewrite in the general case since the expression contains property accesses that could have side effects, and I'm guessing the rewritten version doesn't always access the properties the same number of times as the original.
|
# ? Oct 29, 2014 16:31 |
|
ReSharper is nice for lazy .Net devs (like me). Now if there was something like it for Apex then I would never need to think about writing neat code again.
|
# ? Oct 29, 2014 19:33 |
|
Subjunctive posted:Allocating in hashCode sounds like a horror to me.
|
# ? Oct 29, 2014 20:48 |
|
Sedro posted:I just found out the hard way that java.net.URL's equals and hashCode make DNS lookups. What the hell were they thinking? In case you haven't seen it, here's a relevant video about that.
|
# ? Oct 29, 2014 20:54 |
|
Illusive gently caress Man posted:
Apparently, your coworker is vunerable to for-loops.
|
# ? Oct 29, 2014 21:44 |
|
Sebbe posted:In case you haven't seen it, here's a relevant video about that. That is a good click.
|
# ? Oct 29, 2014 22:02 |
|
In a client's codebase:code:
|
# ? Oct 30, 2014 00:45 |
|
Ithaqua posted:In a client's codebase: Perfect for a microtransaction-filled future where your procedure will return once you pay 50 IntelPoints.
|
# ? Oct 30, 2014 00:56 |
|
1337JiveTurkey posted:Perfect for a microtransaction-filled future where your procedure will return once you pay 50 IntelPoints. Otherwise, it throws an OutOfMoneyException.
|
# ? Oct 30, 2014 01:09 |
|
It's me, I'm the horror. I wrote:code:
I meant: code:
|
# ? Oct 30, 2014 01:33 |
|
http://stackoverflow.com/questions/1006923/automating-office-via-windows-service-on-server-2008/1680214#1680214 To summarize, if you want to use PowerPoint automation through Interop in a Windows Service, you have to create a magic folder deep in the bowels of system32 - otherwise your program will just hang.
|
# ? Oct 30, 2014 02:38 |
|
Sebbe posted:In case you haven't seen it, here's a relevant video about that. The more I learn about Java, the more I scream
|
# ? Oct 30, 2014 08:38 |
|
ATM Machine posted:The more I learn about Java, the more I scream As the video says though, FindBugs does report all of those issues.
|
# ? Oct 30, 2014 09:27 |
|
ATM Machine posted:The more I learn about Java, the more I scream
|
# ? Oct 30, 2014 10:25 |
|
Why is it that mediocre programmers think that writing mediocre code will grant them job security? Im so sick of hearing people say this "jokingly" when faced with criticisms (then they keep doing the same mediocre poo poo).
|
# ? Oct 30, 2014 12:18 |
|
Soricidus posted:Here's the fun part: the same kinds of gotchas certainly also exist in every language you like. You probably just don't know yet, because only a handful of languages, including Java, are sufficiently widely used and well understood for many people to be aware of such flaws. Also in Java those gotchas exist predictably across platforms, rather than being related to the particular compiler, runtime library, computer architecture and phase of the moon under which your code was compiled and run.
|
# ? Oct 30, 2014 14:15 |
|
Subjunctive posted:A tool that did such simplification automatically would print money. You're in luck. http://www.wolframalpha.com/input/?...6+c+%26%26+d%29 With code:
|
# ? Oct 30, 2014 17:11 |
|
thathonkey posted:Why is it that mediocre programmers think that writing mediocre code will grant them job security? Im so sick of hearing people say this "jokingly" when faced with criticisms (then they keep doing the same mediocre poo poo). Yeah this is the worst kind of poo poo. I had a guy like that once. But he also had this philosophy of "I will write better code when I get paid better." Why not show that you can actually write good code in the first place and thus deserve better pay? I had zero evidence that he was capable of performing better. How dumb would I need to be? Eventually fired him. Also I ran into this today: code:
|
# ? Oct 30, 2014 18:51 |
|
thathonkey posted:Why is it that mediocre programmers think that writing mediocre code will grant them job security? Im so sick of hearing people say this "jokingly" when faced with criticisms (then they keep doing the same mediocre poo poo). If they were capable of writing good code, they'd be doing that already.
|
# ? Oct 30, 2014 19:17 |
|
Internet Janitor posted:Also in Java those gotchas exist predictably across platforms, rather than being related to the particular compiler, runtime library, computer architecture and phase of the moon under which your code was compiled and run. Count yourself lucky if you never came across a platform specific jvm issue. Not even talking about oracle vs open. We have a test suite of 2000+ tests that pass on OSX and hang on a deadlock in the test runner on Linux. Guess what our prod environment is.
|
# ? Oct 30, 2014 20:57 |
|
Hughlander posted:Count yourself lucky if you never came across a platform specific jvm issue. Not even talking about oracle vs open. We have a test suite of 2000+ tests that pass on OSX and hang on a deadlock in the test runner on Linux. Guess what our prod environment is. why are you developing not in a VM of your prod environment.
|
# ? Oct 30, 2014 21:12 |
|
Hughlander posted:Count yourself lucky if you never came across a platform specific jvm issue. Not even talking about oracle vs open. We have a test suite of 2000+ tests that pass on OSX and hang on a deadlock in the test runner on Linux. Guess what our prod environment is. That's plausible, but in such case my money would be on a bug in multithreaded code (unsafe publishing, race condition, etc) that may manifest itself differently on different platforms, but is a code bug nonetheless.
|
# ? Oct 30, 2014 21:21 |
|
|
# ? Apr 20, 2024 03:43 |
|
Ithaqua posted:I did two days of unit testing training with one of my clients last week. It was pretty great, they went from not understanding the difference between a unit test and an integration test to actively discussing the pros and cons of methods of IOC and how they're going to tackle isolating their dependencies going forward. I ran into "tests" the other day that required a MongoDB instance, a web service, and some local console app
|
# ? Oct 30, 2014 22:28 |