- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
void main(char** argc, int argv) { Frist(); }
** Compilation successful, 0 errors
Admin
now I expect story about flawless linkage and flawless runtime
Admin
So the guy had no idea the compiler didn't catch all possible errors, but was smart enough to fix them? A bit unbelievable.
Admin
Surely a compiler would complain about that immediately? Wouldn't it be an interpreter that wouldn't spit out an error until runtime?
Admin
Addendum 2018-07-19 08:14: Oops. Forgot formatting.
Admin
Funny - a major Dutch supermarket actually is called Jumbo. I doubt they were one of the first in the webshop business, though. IIRC the first in the Netherlands was AH.
Admin
Your compiler compiled that code just fine. Then the linker complained that Frist() didn't exist.
Admin
I've seen the similarly stupid sentiment that you can't have errors in dynamically typed languages because everything can fit into everything.
Admin
Logic errors my friend
Admin
Look again - Nick didn't fix it, Fred did.
Admin
No, it was Fred who fixed the errors.
Admin
Better yet:
$ gcc -Werror frist.c /tmp/ccGOW0qp.o: In function
main': frist.c:(.text+0x15): undefined reference toFrist' collect2: ld returned 1 exit status $
Addendum 2018-07-19 09:26: Doh...
Admin
No. Fred fixed it.
Admin
But it's still weird how Nick ever gets any code to work.
Admin
Those customers are the worst...
Admin
This Fred character really sucks at explaining things. It should have been as simple to explain as this:
Say you've been tasked to write a program that prints "HELLO". Instead you program it to print "GOODBYE". It compiles. Is it correct?
Admin
Had that sort of thing happen to me a few times back in the day. Newbie developer comes to me whining about his/her program crashing and burning while running unit tests with a forlorn wail of "but it compiled without errors!!". Sigh.
Admin
Close but no cigar. Your example program fails in the sense of not meeting requirements. But it doesn't crash. It runs to completion.
Idiot Nick in the story seems to believe the compiler can't create crashing code. So if an app crash occurs it's evidence of a defective compiler, OS, or hardware. Of course that's nonsense.
void main(...) { main(...) } // this'll compile but crash
void main(...) { throw new Exception(...) } // this'll compile but crash too
Nick's POV is such nonsense that it really undermines the credibility of the whole tall tale. Assuming the story is true-ish, it makes me wonder if Nick is more like an admin script writer or ETL tool user who's used to living in a safe sandbox. Somehow he got thrown to the wolves to write code in a strange language for an unfamiliar environment and quickly was in way over his head.
Admin
In fact, even when writing admin scripts, the first time anyone who ever wrote a program managed to go through compile, the program would not b doing what it was supposed to do (except maybe for hello world).
Simply because it is almost impossible to get a slightly complex program run true the first time. So surely, Nick has never written any program (this includes scripts)
Admin
"We debugged until it compiled without errors."
So that's what debugging is.
Admin
let's give this the benefit of the doubt and imagine that in his technology unit-tests are a part of compilation process :)))))))))))))))))))))))))))))))
Admin
It compiles, runs and at some point terminates, of course it is correct! The question you gotta ask is: "is it doing what it's supposed to do?"
Admin
Compiles without any problems, so it means there are no errors in this code!
Admin
Many of these stories would be a lot shorter if the protagonist just laid cards on the table rather than trying to lead a fool by the nose. “It compiles, but you said it doesn’t run. Forget that it compiles, let’s find the **** bug.”
Admin
But there is no bug, don't you understand? It compiles!
Admin
And it might run without problems, too. Depending on compiler settings, language concepts, etc.
You know that a division of a non-zero number by zero results in an infinity, according to IEEE 754?
0.0/0.0 would result in a NaN, btw. Just another special, but well defined, case.
Admin
cf. https://thedailywtf.com/articles/The-Pesky-e https://thedailywtf.com/articles/Exceptionally-Hard-to-Swallow and others
Addendum 2018-07-21 09:59: Where did my line breaks go?
And, addendum:
and many, many others
Admin
I did that once, porting a major application from one operating system to another. I switched the compiler and built the project. 4,500 compiler errors. The reason the number was so low was because the compiler stopped counting at 99 errors in a source file. Took me a few months to make it compile without errors. And another day to make it run successfully.
Admin
Pfft. VB was the best, just slap "On Error Resume Next" at the top of every procedure and boom - compiles first time, every time!
Admin
The worst feeling is when you implement a new big feature and it runs the very first time. There's no way I can trust it to function.