|
Trammel posted:Why it copies the contents of each row into another variable? .. Because dereferencing is just so hard!
|
# ? Feb 13, 2009 08:12 |
|
|
# ? Apr 27, 2024 13:50 |
|
GrumpyDoctor posted:homegrown resizable array that's basically std::vector without bounds checking I know you probably know that, but it is a common myth about the STL.
|
# ? Feb 13, 2009 10:35 |
|
rjmccall posted:I'm curious if there's a difference between DynamicArray::Size() and DynamicArray::GetNumb().
|
# ? Feb 13, 2009 16:45 |
|
My girlfriend wrote this:code:
|
# ? Feb 14, 2009 05:52 |
|
Contero posted:My girlfriend wrote this: The horror The horror
|
# ? Feb 14, 2009 06:05 |
|
Some javascript/jQuery:code:
|
# ? Feb 14, 2009 06:25 |
|
Contero posted:My girlfriend wrote this: Fixed that for you.
|
# ? Feb 14, 2009 08:06 |
|
Contero posted:Which took a while to explain why j = j++; is pretty much the same as saying j = j;. The real horror is you
|
# ? Feb 14, 2009 08:07 |
|
UraniumAnchor posted:Fixed that for you. its undefined
|
# ? Feb 14, 2009 08:20 |
|
UraniumAnchor posted:Fixed that for you. I thought it might work that way too. But it doesn't in Java. Observe! code:
code:
|
# ? Feb 14, 2009 08:30 |
|
I'm doing some embedded development on a custom-designed board provided by some company. They wrote software to run on the board. It all works perfectly, the board is great, and they documented it well, but their code is atrocious. First off, there's a file called "include.h" which includes all of the header files. Then every source file includes "include.h" What's in those header files? Well, there's this: code:
code:
code:
|
# ? Feb 14, 2009 08:45 |
|
TSDK posted:Just so we're clear, unless you're using .at(n), then std::vector doesn't have to have bounds checking either. Some implementations choose to add bounds checking to operator[] in debug builds, but it'll get compiled out in a release build. I didn't actually know that, thanks for telling me. That being said, "doesn't have bounds checking in debug mode whereas my STL implementation does" was still a big problem, because when I went through and changed a bunch of these things to vectors the program started throwing out-of-bounds exceptions all over the place. The bugs I was trying to fix weren't merely incorrect behavior - they were actually undefined behavior and I guess nobody noticed!
|
# ? Feb 14, 2009 08:54 |
|
Kilson posted:I thought it might work that way too. But it doesn't in Java. Observe! The real horror is Java. tripwire posted:The horror Ok how about : Contero fucked around with this message at 09:19 on Feb 14, 2009 |
# ? Feb 14, 2009 09:15 |
|
I love the Thing class. From now on all my objects will derive from Thing.
|
# ? Feb 14, 2009 23:08 |
|
Contero posted:The real horror BlueJ flashbacks! D:
|
# ? Feb 14, 2009 23:08 |
|
Contero posted:The real horror Ah yes. The Thing class.
|
# ? Feb 14, 2009 23:32 |
|
Let me guess, the Thing class implement a name property.
|
# ? Feb 16, 2009 00:03 |
|
Contero posted:My girlfriend wrote this: UraniumAnchor posted:Fixed that for you. You're both wrong, it's undefined behavior because you're modifying j multiple times between sequence points. Edit: Oh, nm didn't realize it was java That Turkey Story fucked around with this message at 00:44 on Feb 16, 2009 |
# ? Feb 16, 2009 00:27 |
|
Again, not strictly a coding horror, but come across while dealing with the code.code:
So we have the full number: two hundred thousand, six hundred and nine, being stored in one column, requiring split & join operations in the program, rather than storing two values, 2000 and 9, stored in separate, more easily indexed, more easily processed columns.
|
# ? Feb 20, 2009 00:21 |
|
I got Bel-Aired by some very annoyingly written collection management software today:code:
But seriously, why the hell is the function called "bellair"? Why not just attach the cookie check to an onsubmit?
|
# ? Feb 20, 2009 00:37 |
|
On a single line: if ((!( src in usr.contents ) && (((!( isturf(src) ) && (!( isturf(src.loc) ) && (src.loc && !( isturf(src.loc.loc) )))) || !( isturf(usr.loc) )) && (src.loc != usr.loc && (!( istype(src, /obj/screen) ) && !( usr.contents.Find(src.loc) )))))) return drat past developers!
|
# ? Feb 20, 2009 01:57 |
|
FeloniousDrunk posted:
|
# ? Feb 22, 2009 02:06 |
|
On friday i was asked to update a small internal app, all it needed was a few little changes, maybe a weeks of work. A coop student wrote this, about 5 years ago in Java. What the gently caress...? A small snippet of a function: code:
The name of that function is a 0 Comments. FML.
|
# ? Feb 22, 2009 19:30 |
|
UberJumper posted:
Part of me wants to see what b() and c() are. That code almost looks like it came out of a bytecode "decompiler."
|
# ? Feb 22, 2009 21:00 |
|
UberJumper posted:... I've unintentionally written code like that. It happens when I'm working through some mathematical process on paper or referencing a math book and start mindlessly copying what I've worked out into the code. The difference is that I look at the code when I'm done, realize it's crap, and search-and-replace with useful names. I can't imagine skipping that last step in code other people have to work with. Even if I don't care about making their lives easier I don't want people to think I'm retarded.
|
# ? Feb 22, 2009 23:21 |
|
I think the old coop student (who will become a wind-chime soon) didn't use a decompiler. I looked a bit into java Decompilers, but from my understanding is that in java it will return the original functions names, etc. It also keeps comments Also this code, has sprinkles of names that, are slightly more descriptive. There is just random blobs of BS code like this(its almost all BS code). I don't quite understand how this works, the vast majority of the code though. To me, this shouldnt work, gently caress i dont even know why it works. I dug around and looked at b. Theres two b's First: code:
code:
I don't understand.... Would this function even change anything? Aside from manipulating the global RET value(even though it can never be false here.)..... The comments are the most descriptive ever. I love my job.
|
# ? Feb 23, 2009 02:04 |
|
UberJumper posted:
It doesn't even do that!
|
# ? Feb 23, 2009 02:52 |
|
If I had to guess, I would say a source-to-source compiler of some sort — possibly an extremely buggy one.
|
# ? Feb 23, 2009 02:57 |
|
code:
No, really, my Java is rusty, and I have no idea what in the flying hell this means or is doing. He's casting "60D" to an int. But what the hell is 60D? A constant? I didn't think any sane programming language let you start constants with numbers, though that would also explain the "22D"... and that scares me. Did this guy learn to code in BASICA, and just never got over insane variables?
|
# ? Feb 23, 2009 03:28 |
|
McGlockenshire posted:
xxxxD forces the number xxxx to a double. Can do the same with xxxxF for float.
|
# ? Feb 23, 2009 03:31 |
|
UberJumper posted:I think the old coop student (who will become a wind-chime soon) didn't use a decompiler. I looked a bit into java Decompilers, but from my understanding is that in java it will return the original functions names, etc. It also keeps comments Even if this is the case, an obfuscation program could still have been used to strip any useful names or comments.
|
# ? Feb 23, 2009 04:09 |
|
TRex EaterofCars posted:xxxxD forces the number xxxx to a double. Can do the same with xxxxF for float.
|
# ? Feb 23, 2009 07:40 |
|
McGlockenshire posted:But... if it's being created as a double, why is he immediately casting it to an int? And since when have primitive non-decimal numbers been anything but ints? This assumes that the coder thought of this. This code makes my head hurt. Thats what i am wondering, its full of litttle things that have enough little things (random comments, including one about subtle anal sex ) to make me think it wasnt decompiled. I think it was done as a gently caress you kind of thing. Anyways im working on this today so i'll see if i can find function c
|
# ? Feb 23, 2009 13:08 |
|
McGlockenshire posted:But... if it's being created as a double, why is he immediately casting it to an int? And since when have primitive non-decimal numbers been anything but ints? This assumes that the coder thought of this. This code makes my head hurt. I couldn't even venture a guess. Probably some rear end in a top hat making things more complex than they need be to justify how smart they are.
|
# ? Feb 23, 2009 15:35 |
|
TRex EaterofCars posted:I couldn't even venture a guess. Probably some rear end in a top hat making things more complex than they need be to justify how smart they are. "I'm bored and this is all I have to do! Let's see how many lines of code I can make it..."
|
# ? Feb 23, 2009 15:40 |
|
UberJumper posted:
UberJumper posted:I dug around and looked at b. I think there may be a 3rd be somewhere that you missed... looks like he is using 3 parameters in every function call.
|
# ? Feb 23, 2009 18:55 |
|
Whats weird is that l1 in b(int,int) is declared int, but then is assigned the return value of the double b(int) method. Funny he wasnt forced to cast there, considering he probably had no clue how basic types work and just "used the most exact one wherever possible to get rid of all those pesky errors" so he creates/wraps everything as doubles, but then needs to add casts to allow them as array indices. Since all variables are ints and should be passed by value, doesnt the part of a you posted just do this? code:
RoadCrewWorker fucked around with this message at 19:16 on Feb 23, 2009 |
# ? Feb 23, 2009 19:01 |
|
It's probably been obfuscated (by a very ambitious obfuscator) if you're sure it hasn't been decompiled.
|
# ? Feb 23, 2009 19:10 |
|
I see the class is called "d". Is the a() being called in that code snippet an overloaded version of the a() that snippet is from, or is there an early return above that part?
|
# ? Feb 23, 2009 19:26 |
|
|
# ? Apr 27, 2024 13:50 |
|
Yeah so i found the other b function, it was buried. I showed my boss some stuff, and basically told him its FUBAR. I don't think its been run through a code obfuscator, since half of the code can make sense, otherwise its the most ambitious/random obfuscator, i have ever heard of or seen. The update (which is to add a little bit more functionality to it) has been put on hold . But i love this, so i will keep digging when i have time Function B: (this is pretty much all unmodified, i changed the employee name written in the code though) code:
I like the nice little, rant though. It made me warm and fuzzy. *EDIT* Fixed it so it doesnt destroy the page. *EDIT2* Sigh, is there a better way to do this? I cant stop it from destroying this page. UberJumper fucked around with this message at 03:00 on Feb 24, 2009 |
# ? Feb 24, 2009 00:52 |