|
|
|
| Non-WTF Job: Interface Designer/Front-end Developer at Naviance (DC) |
| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Page 5 | Next » |
|
why didn't he just use a database? everyone knows databases are more efficient then excel...
|
|
The real WTF is definitely forgetting about the panendermic semiboloid. That's inconceivable. INCONVEIVABLE!
|
|
Simply returning the input - 273 would not give an out of range error. Obviously that would not be a correct solution. the programmer knew what (s)he was doing.
BTW, why have no comment on the comic been photographed on a wooden table? I keep scrolling through, but apparently no one knows the proper way of creating an image for a website. Captcha: dignissim. |
You keep using that word. I do not think it means what you think it means. |
|
Shoudln't worky anyway since he uses = instead of == for comparisons.
|
|
trwtf is that they didn't just replace the entire system with one or two lunar wainshafts and a differential girdle spring.
|
|
Nobody noticed
if (Ktemp= 273 ) what about == ? |
|
The use of a spreadsheet is a sure sign of a sick mind.
The "programmer" obviously used the spreadsheet to auto-generate a bunch of lines, probably using some clever formula. This means that the idiot was clever enough to know Excel macros, but too dumb to understand the concept of a temperature difference. The guy should be banned from touching a compiler. |
|
It's worth pointing out, for those who didn't realize it, that finding the difference between two temperatures in Celsius yields the exact same result as taking the difference of the temperatures in Kelvin.
So in those precious few occurrences, the function calls had no effect on the value of the expression. |
Of course... select C from KtoC where K = %1 Just remember to wrap it in a COM object and give it an "enterprise" interface. |
I guess all the temperature differentials were exactly zero. Not very useful I imagine. |
|
but then the delta is the difference in Celsius!
surely you need a K2C function to handle that! //see comment.xls |
|
Clearly, he should have rerouted the tachyon beam through the forward deflector, remodulated the forward phaser bank, and ordered number one to take a number two.
|
|
Lots of issues here besides the = vs. == thing.
-- the returns aren't followed by a semicolon. Won't compile. -- if the temperature is out of range, it simply printf()s a message (also without semicolon) without returning a value. Won't compile. -- extra } at the end. Won't compile. Oh, and "Ktemp int" vs. "int Ktemp". Won't compile. |
|
Looking at that last else, it shouldn't even compile. Not all code paths return a value...
Besides, there's a braces mismatch in the last line. The real WTF is someone who put non-compiling code into the source... |
|
The other WTFery aside, you don't need formulas to do that easily in Excel. You can just type in the first number (in B1, for instance), type in the second number (B2), select the two cells, then click-and-drag the little dot in the bottom-right corner there as far as you want and it'll fill in the column with the sequence (273, 274, 275... 303)
|
Not true in C. |
Its also missing semi-colons. Maybe its a 'C' like language, or probably an obfuscation issue. |
Thanks for mentioning that. It's not rocket science. |
|
The Real WTF is that he never found out what was actually causing the problem. A bit of a tease, this one.
|
|
he probably used excel to type in a number value in a cell and then drag the small dot in the bottom-right of the cell downwards and microsoft fills the cells incrementing the number. In cases it's not a number, it just repeats that data through the cell. that's why maybe he typed the numeral values in different cells and just dragged the whole thing down.
neways.. this is one awesome WTF @DeLos: Since the Celsius-Kelvin are difference scales and not factor scales, the delta is same in both Celsius and Kelvin. |
|
maybe, just maybe, i would like to think that the excel table was meant to be an interpolation table to account for non-linear sensors.
however, as interpolation like that is extremely non-trivial, I wouldn't doubt that the original programmer got hung up on it and just threw something together. |
There are plenty of problems besides not returning a value. GCC only gives a warning, and even then, only if you ask for warnings. |
It's not even spelled the way he thinks it's spelled--at least not when in ALL CAPS. |
|
Did anyone else notice the problem between the code:
if(Ktemp= 273 ){return 0 } else if(Ktemp= 274 ){return 1 } else if(Ktemp= 275 ){return 2 } else if(Ktemp= 276 ){return 3 } and the comment that it could be replaced by: "return Ktemp-270;", Returns a completely different value 273-270=3, not zero! |
Unless the temperature happens to be outside of the 273...303 K ;). |
|
how would the code work if the code should be
Ktemp==273 while if he uses Ktemp=273, it'll just assign the rhs value to the lhs and the program won't work. |
This reminds me of a very funny joke: /* world's last mistake in C */ if(code = CODE_RED) { launch_missles(); } |
yes, it will, if you invert the phase polarity. |
|
The sudden influx of technobabble concentration causes fluctuation of the distortion field, and we may have to remodulate the confinement of the problematic plasma flow to prevent its further deterioration.
|
|
They might not have hand typed the xls file. In excel there's a way to fill a row down and have it auto increment each row.
Another possibility I've done/seen is to make a formula, implement it, once you have the correct data, copy the entire book, then paste special it as "just values" this way no one can muck up your data. Just because the final output doesn't have the formulas doesn't mean he didn't use some of the easier tools in Excel, otherwise he likely would have created these files in C++/other language. |
Well, no shit, sherlock. It's a standalone function, not a complete program. There obviously won't be any #includes. |
So... Did you notice that the original code always returns 0? Can you see why? (Hint: Look at some of the other posts above). |
|
I can't believe I forgot to put this in my last post. The code could be made so much more efficient via use of the switch. Maybe that is the point in the article we have all been missing.
captcha: quibus |
|
The real wtf is obviously using
C = k - 273 Should be C= k - 273.15 |
|
Yeah, to quote another post here "No shit, sherlock!" Did you not see the other posts that said it might be an in-house C like language, or a mistype in copying the code.
|
const int CODE_RED = 0; /* saved the world */ |
|
Nope, missiles still got launched. World saving attempt FAILED.
|
|
(but you are lucky that he is only launching 'missles', whatever they are, not 'missiles')
|
That will just put code to 0 and fire them anyway. |
|
The real WTF is that he realized that not only is that function a complete mess, but it's totally unnecessary and he should have removed it. Every codebase has crappy code, but if you just leave it lying around without doing anything about it you're only adding to the problem. The correct solution is:
1) Delete that function. 2) Change the few occurrences so that it just uses difference in Kelvin temps. 3) Make sure the Johnson rod is functioning correctly. |
|
Does that even compile? I thought the return statements had to have a semicolon...
|
World's safe...for now. ;-) |
Functions are not required to return a value in C (or, for that matter, C++). A C programmer would know that. Of course the value returned by such a function is undefined (usually whatever's lying around in the appropriate register): $ cat /tmp/t.c |
...until some smartass maintainer "fixes" the "bug" in the 'if' statement, and checks in without testing. |
Regardless of the code always returning 0, the suggestion in the article that the entire method could be replaced by "return Ktemp-270;" is incorrect. It should be: "return Ktemp-273;" and that is what the original poster is pointing out. |
That comment of yours might actually be counterproductive :O To quote Pratchett, "Of course someone would be that stupid. Some humans would do anything to see if it was possible to do it. If you put a large switch in some cave somewhere with a sign on it saying "End-of-the-World Switch. PLEASE DO NOT TOUCH," the paint wouldn't even have time to dry." |
|
[obligatory]
4) ????? 5) Profit! [/obligatory] |
|
I call reasonable doubt on the "all typed by hand" of the Excel file.
The programmer could very well have used the type-and-drag feature of Excel (type number, select cell, drag down, ????, profit!)... |
You fail at programming. The value of an assignment is the assigned value, in this case 0. if() interprets that as false and doesn't execute it's code block: if(code = CODE_RED) { launch_missles(); } if(code = 0) { launch_missles(); } if(0) { launch_missles(); } ; //Notice how nothing happens |
| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Page 5 | Next » |