|
Avenging Dentist posted:I've got bad news for you. Well the wacky-rear end nonstandard one for the systems I work on doesn't check code:
BattleMaster fucked around with this message at 04:31 on Nov 11, 2009 |
# ? Nov 11, 2009 04:29 |
|
|
# ? Jun 6, 2024 05:52 |
|
BattleMaster posted:Well the wacky-rear end nonstandard one for the systems I work on doesn't check Excuses, excuses. Next you'll tell me you don't want to implement your own (working) version of libc.
|
# ? Nov 11, 2009 04:32 |
|
Avenging Dentist posted:You do realize this is not only legit, but required to avoid a leak? (Unless there's some other behavior in UnregisterChild that breaks things). Sorry, I've been staring at this all day and maybe I forgot it's not obvious. Look at the call stack: code:
Solved it by copying the vector to a backup, clearing, then deleting, but it was a pain to search through all the destructors looking for this. TOO SCSI FOR MY CAT fucked around with this message at 05:13 on Nov 11, 2009 |
# ? Nov 11, 2009 05:11 |
|
Janin posted:Sorry, I've been staring at this all day and maybe I forgot it's not obvious. Look at the call stack: Well, not having the implementation of that, I figured it wouldn't care about that. Thought I can't fathom why something that appears to be a tree would need to care about its siblings.
|
# ? Nov 11, 2009 05:12 |
|
Avenging Dentist posted:Well, not having the implementation of that, I figured it wouldn't care about that. Thought I can't fathom why something that appears to be a tree would need to care about its siblings. I posted the implementation of UnregisterChild() in the original code block each leaf contains pointers to its parents, and children, and siblings, and random other nodes elsewhere in the tree because the guy who designed this library doesn't have to implement it, so he doesn't care how difficult working on it is
|
# ? Nov 11, 2009 05:15 |
|
Janin posted:I posted the implementation of UnregisterChild() in the original code block And nothing in the code you posted breaks anything. I mean, I know why it would fail, but that part isn't actually shown. Avenging Dentist fucked around with this message at 08:49 on Nov 11, 2009 |
# ? Nov 11, 2009 08:43 |
|
Janin posted:Sorry, I've been staring at this all day and maybe I forgot it's not obvious. Look at the call stack: As long as UnregisterChild() (or something else in the destructor) removes the child from the parents list of children, it looks like it should work. That seems to be the intent of the code even though that step was omitted. (Unless each child needs to UnregisterSibling on each other child. Then that won't work.) It's a bug, but I don't see the horror.
|
# ? Nov 11, 2009 10:47 |
|
Tim Berners-Lee posted:It's a bug, but I don't see the horror. code:
|
# ? Nov 11, 2009 14:32 |
|
Tim Berners-Lee posted:As long as UnregisterChild() (or something else in the destructor) removes the child from the parents list of children, it looks like it should work. That seems to be the intent of the code even though that step was omitted. (Unless each child needs to UnregisterSibling on each other child. Then that won't work.) It's a bug, but I don't see the horror. The point is that 1) the destructor leaves dangling pointers in attributes and 2) deleting children can call methods which access those pointers. You're over-thinking it, just look at the code and you'll see that as soon as the first child is deleted the object enters an invalid state.
|
# ? Nov 11, 2009 19:16 |
|
no wonder I can't find any uses of method getTaxRateUS().code:
|
# ? Nov 11, 2009 20:29 |
|
Impressive, particularly since that entire thing is just:code:
|
# ? Nov 11, 2009 21:38 |
|
BattleMaster posted:Well the wacky-rear end nonstandard one for the systems I work on doesn't check PowerTV? That is a joke of an OS and nothing is compliant. I would perfectly expect to see code exactly like that to get around some undocumented "feature". HFX fucked around with this message at 21:46 on Nov 11, 2009 |
# ? Nov 11, 2009 21:42 |
|
why do I keep seeing crap like this. #define BSP_DISABLE_RXMP __BSP_DISABLE_RXMP__ and such. Really who does this poo poo help?
|
# ? Nov 12, 2009 01:55 |
|
HFX posted:PowerTV? That is a joke of an OS and nothing is compliant. I would perfectly expect to see code exactly like that to get around some undocumented "feature". Nah, it's for a PIC18 microcontroller. Some of the weird poo poo that you have to come up with to get things to run within the memory and clock speed constraints are pretty awesome though. I did some thinking last night and thought a of reason why it works that way. If you want your program to execute faster and you are confident that the pointer isn't invalid you can forgo checking it. Also, you can call the stack relinking function once after freeing a whole bunch of things so it only happens once instead of every time. Now normally that wouldn't matter a whole lot but sometimes you just want something to be as zippy as possible because it's running on a battery and clocked at 100kHz to save power. Sometimes embedded systems are coding horrors in and of themselves Edit: though to be honest I kind of want to write my own malloc/free implementation now because it would be way more efficient to just unlink the segment you just freed rather than periodically iterating through the entire heap to see if stuff was flagged as free. Oh god it's me, I'm the coding horror BattleMaster fucked around with this message at 02:17 on Nov 12, 2009 |
# ? Nov 12, 2009 02:05 |
|
rjmccall posted:Impressive, particularly since that entire thing is just: It gets even worse when you know the context. There's only one method it will ever match.
|
# ? Nov 12, 2009 02:08 |
|
Janin posted:Please post more details about insane Japanese software, because this post right here is incredible. This one is tame, except it does it for EVERY. SINGLE. PROMPT. in a 100+ step installation checklist.
|
# ? Nov 12, 2009 03:24 |
|
Wow, that's....is it all command line?
|
# ? Nov 12, 2009 05:37 |
|
Ensign Expendable posted:Wow, that's....is it all command line? Yes, though to their credit, the customer never sees this part (it's the install process for the OS that lives in one of our appliances).
|
# ? Nov 12, 2009 06:10 |
|
Does it go on to ask if you're sure that you're sure that "yes" is correct?
|
# ? Nov 12, 2009 06:19 |
|
The brilliant part is that it defaults to 'yes' which means that it's not actually confirming anything. You could make a slip on the enter key and probably race through half the prompts without realizing it. It's stupid, but at least inoffensive in its implementation.
|
# ? Nov 12, 2009 06:53 |
|
Couldn't you do something like code:
|
# ? Nov 12, 2009 21:19 |
|
MagneticWombats posted:Couldn't you do something like I never never heard of this. It's so hilariously simple, and useful.
|
# ? Nov 12, 2009 22:16 |
|
MagneticWombats posted:Couldn't you do something like this works until: code:
|
# ? Nov 12, 2009 22:18 |
|
Ryouga Inverse posted:this works until: One would think that if you were installing an operating system onto a device, that this wouldn't matter. Also one would think that you'd know what the prompts were before you decided you could pipe yes into it.
|
# ? Nov 12, 2009 22:21 |
|
Ryouga Inverse posted:this works until: If typing yes to those questions doesn't erase the hard drive, why did they prompt you about it?
|
# ? Nov 13, 2009 00:06 |
|
Here's some more barrels from our UI code:code:
code:
|
# ? Nov 13, 2009 00:11 |
|
MagneticWombats posted:Couldn't you do something like Can't drop to shell. Usually we hook it up to a serial console and cat in a long text file that looks like this: quote:
One time it broke and we couldn't figure out why; turns out the intern went and opened it in notepad and wondered why there were squares all over the place. He replaced all the squares with newlines and saved it. Why did this break everything? a) what's unix's default newline? b) what's the newline for the DOS .txt format that notepad.exe still uses? edit: "but it worked in putty! "
|
# ? Nov 13, 2009 00:12 |
|
Ryouga Inverse posted:this works until: I can't figure out a way to make yes take a line feed. Just strips slashes here on OS X.
|
# ? Nov 13, 2009 00:13 |
|
Mustach posted:Here's some more barrels from our UI code: Does this deliberately cause a stack depth exception of some kind?
|
# ? Nov 13, 2009 00:53 |
|
Based on all evidence that I could find, it was not intentional.
|
# ? Nov 13, 2009 02:37 |
|
Avenging Dentist posted:No because delete checks for null before it does anything.
|
# ? Nov 13, 2009 04:42 |
|
Sweeper posted:You explain that to my programming professor who marked down my code because I didn't check for NULL. I showed him the iso standard and he didn't give me my points back. My programming professor took off marks for returning from a void.
|
# ? Nov 13, 2009 05:26 |
|
Maybe this isn't quite a coding horror, but I'll tell it anyway. About five months ago, I was looking around the simple machines site (a forum software package), and noticed that RC1 of the new 2.0 version was released a few days earlier. I thought "oh cool i'll update my forum to the new 2.0 tonight", since my forum is fairly low traffic and not super vital. Plus I like using cutting edge software. I got busy and eventally just decided to wait a few more days until 2.0 proper gets released. Fast forward to today. I went to the site to see what the heck is going on and I see that there was a RC1.1, RC1.2, and now RC2. I take a look at the changelog and I see this:quote:SMF 2.0 RC2 8 November 2009 This is just for the first 8 days of November. I think someone doesn't know what "release candidate" means...
|
# ? Nov 13, 2009 08:46 |
|
Found this looking over a new programmer's code.code:
|
# ? Nov 14, 2009 15:51 |
|
pokeyman posted:I can't figure out a way to make yes take a line feed. Just strips slashes here on OS X. code:
|
# ? Nov 14, 2009 16:33 |
|
Datyedyeguy posted:Found this looking over a new programmer's code. If this is the worst thing you can find then s/he doesn't sound bad to me. Not to mention that the obvious use of logical not may be incorrect, depending on the type returned by 'HitTest'.
|
# ? Nov 14, 2009 17:29 |
|
Datyedyeguy posted:Found this looking over a new programmer's code. My god. This is only excusable if you guys are being paid per line.
|
# ? Nov 14, 2009 18:03 |
|
That's kind of scraping the bottom of the Coding Horror barrel. Unless I am missing something, it doesn't seriously impact performance, code readability, logical correctness, or anything like that - it's just a bit redundant. Also, are you sure this is the final form this function will take? I can imagine sometimes I might write a function like that if I know that pretty soon there's going to be more going on in it.
|
# ? Nov 14, 2009 18:16 |
|
dimebag dinkman posted:That's kind of scraping the bottom of the Coding Horror barrel. Unless I am missing something, it doesn't seriously impact performance, code readability, logical correctness, or anything like that - it's just a bit redundant. Also, are you sure this is the final form this function will take? I can imagine sometimes I might write a function like that if I know that pretty soon there's going to be more going on in it. Yeah, no it's terrible. It decreases readability.
|
# ? Nov 14, 2009 18:30 |
|
|
# ? Jun 6, 2024 05:52 |
|
It's indicative of 1:1 mental modelling to code, and shows that to him the code only makes sense if it explicit returns "true" somewhere and "false" somewhere else. There's no jump to the higher order of thinking where the return value of the call can be returned, or once you've achieved that, possibly scrapping the helper function altogether because you realize the inner call does everything you need.
|
# ? Nov 14, 2009 19:31 |