- 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
frist! we take over the world
Admin
Oh... we've returned to the era of sheeple with extremely limited intelligence braying the word "frist" as early as they can, like they'll somehow win the approval of their peers, rather then the universal contempt that it actually earns them. Ho hum.
So, the real WTF is a programming teacher rolling into class with some example programs which he hasn't even tried compiling yet? Indeed, from the story, he only gets round to actually looking at the code after the class has started.
Admin
The three universal laws of blog replies: (1) Somebody will say "first" or "frist" (2) Somebody will complain about somebody saying "first" or "frist" (3) Somebody will write an inane comment like this one about somebody complaining about somebody saying "first" or "frist"
Admin
I also like eating and manual labor.
Admin
(4) Someone will write a comment saying how witty the previous insane comment about somebody complaining, such as this one.
Admin
I've never heard of "Edu-C", but is the real WTF the use of c++ comments in a c program?
Admin
So does GCC.
Admin
I don't want to sound like the smart ass, but those aren't "C++ comments". They are normal C comments as introduced in the C99 standard (https://en.wikipedia.org/wiki/C99).
Admin
I don't see the WTF here.
Is it the ASCII art in comments? Meaningful ASCII art in comments can be pretty useful to understand the code, they're even used in Linux kernel code where appropriate.
Is it trying to use an unsupported compiler? That's a rookie mistake, especially since GCC wasn't even installed on the computers.
Is it the fact that Edu-C, probably a dumbed-down C for "education", doesn't understand C++ style comments (//) as opposed to C style comments (/* */)? Many earlier compilers didn't understand them either, they were added to the C standard in C99. Still not a WTF.
I really don't see the WTF here.
Admin
I assume that the compiler merged the line after the comment into the commented line because of the backslash, so it was interpreted as a comment and not compiled.
What does the standard say about this? Are backslashes in comments used for string concatenation?
Admin
I had assumed that the problem was something like the backslash at the end of the comment line was being interpreted as continuing the comment onto the next line. That would explain the code's behaviour but doesn't explain the described symptom of the comment itself not being coloured out. Oh well.
Admin
TRWTF is being able to continue comment lines with backslash-newline. Holy crap.
And then there's the fun you can have with trigraphs. Because we still need to write C code on a terminal WITH UPPERCASE ONLY AND NO CURLY BRACES.
Admin
Perhaps you're not looking hard enough...
Presumably the problem here is related to the backslashes at the end of the lines - this is a continuation character, so the comment continues on to the next line:
Different compilers may not follow the C standards correctly in a number of ways, such as whether they obey the backslash even when it occurs in a comment; whether it must be at the end of the line (or can have whitespace after it) and so on.
Presumably one of the compilers that they tried differed in its interpretation from the other. I find this strange, because my version of gcc interprets the \ in all cases that I tried (even with whitespace etc) - so I'd expect gcc to ignore the assignment in question. But maybe they were using a different version of gcc or something...
Admin
TRWTF is teaching C to a middle-school student.
Don't get me wrong, I think C is one of the best things to happen to humanity, but using it as a teaching tool for kids doesn't seem appropriate to me when you have other tools/languages which might prove more educational and spark their interest instead of burying it below 6 feet of compiler errors.
Admin
Edit: Wow, I'm late.
Admin
She can have a job. I have vacancies.
Admin
And of course...
Ha ha, fun you can have with trigraphs. (For C++, there is a digraph for this as well, but the digraphs are less well known, and frequently resemble smileys.)
Addendum (2013-06-10 08:19): Bah, no there isn't a digraph for , but the rest remains valid.
Admin
Couldn't they just have removed the fluffy story this time? A compiler that extends a comment via a backslash seems like a funny WTF, but the story around it make me not even realize what the hell was the point of it (was it middle-school children, was it the code itself etc?).
Can we please cut down on all the fancy story-telling when it just obfuscates the WTF?
Admin
The real WTF is how this article doesn't mention this at all. And how few of the commenters understand this. Idiots, the lot of you.
Admin
Also, gcc will of course also do this, so the article is even more WTFy.
Admin
You're new here, aren't you?
Admin
To me, TRWTF will always be computer languages designed for educational purposes. The best first lesson for computer programming is that when programming, you follow the computer's rules, and not rules you make up as you go along.
Captcha laoreet: "The speaker's comments has the press corps LAOREET."
Admin
(censored) so I don't sound as much like blakeyrat as I would if I didn't censor what I wrote.
Admin
I was in an actual robotics class with VEX robots (awesome, but getting pricey). Teacher forced the class to use LabVIEW. I fought and used RobotC for Vex.
I was the only one to actually complete assignments (including his 'challenge course' that nobody got as far as I would) and he would bitch because I wasn't using LabVIEW.
... hey, it's easier to subroutine everything in C!
I haven't heard of any sort of edu-C type product. I know in actual robotics (which this probably isn't) you have EasyC... which is basically C, but drag-and-drop C.
Admin
The fluffy story is what differentiates TDWTF from FreeVBCode.com ;)
Admin
I have never complained about the quality of the articles here until now. I think it is written somewhere that TDWTF does not post stories of students or amateurs, but instead tends to post stories of our so beloved "elite programmers". So wtf is this? Next thing you know we will be seing stories where nerdy parents complain that their 5 year old son does not know how to debug PHP.
Admin
(6) Profit!!!
Admin
The real WTF is C and all its illegitimate and doubtless consequentially criminal offspring, amirite?
No, my immediate thought on puzzling out WTF the WTF here is the agreement with the frighteningly precocious child not to do something nefarious with the knowledge she had gleaned.
See that brier-bush over there? Oh please, Brer Fox, please don't throw me into it!
Admin
And when I 'google' killer robot, all I can find are news stories. Sign of the times I suppose.
Admin
The Daily WTF has been going downhill since Alexander the Great stepped back.
Admin
Admin
There's not just one TRWTF in this!
This story takes place in middle school. Nothing good comes out of middle school, except Chuck Norris facts and 'That's What She Said' invocations at awkward times.
The teacher nicely asked a middle school student not to write a program to take over the school. This means, that the minute he walked away, that was her first priority in life. She may or may not succeed, but still.
The compiler fail. But, it makes for a distant third compared to the other two.
Admin
Admin
So, isn't this just an error in de text-editor's syntax highlighting?
Admin
Hear, Hear!
Admin
Admin
TL;DR: There's actually a WTF in the code, a nice trap in ASCII art where a trailing backslash inadvertently hides the following line. Just pointing this one apparently isn't fancy enough to you, so you messed it up with (fictional) storytelling and (fictional) compiler dependencies.
Alex, please, if your new editors can't do a better job, fire them! The only TRWTF recently has been this site itself with its butchered stories.
Inb4: Yes, I can have all my money back I paid for reading this site, blah blah. Yet, at least I'm hoping that someone still has an interest in the quality of the articles.
Admin
The same code was posted in http://orbiter-forum.com/showthread.php?p=410945 by Artlav almost 3 months ago. He asks if someone can see his mistake. He produces add-ons for Orbiter, as you can see here: http://www.orbithangar.com/searchauth.php?search=artlav
The real WTF is inventing a class, with young students, with a fictional edu-C compiler, instead of making fun of those funny comments and the importance of commenting evrything in code.
Admin
"An middle-school student" - ugh! There's nothing worse than using an instead of a; I'll assume that was a typo.
Admin
I'd give you +1 on this if this wasn't the (censored) google thing also-
Admin
(Or, as per captcha: dolor. - Pain. Real pain.)
Admin
Six million Jews might disagree with you on this
Admin
You know when you were about 10 years old you used to have to do Reading Comprehension? I advise you get a bit more practice in.
The article IS about professionals... the Edu-C people, or maybe the teacher who installed it. The story actually suggests this pupil is quite bright, and crucially doesn't make her out to be the WTF.
Clearly the WTF is this lax teachers lesson plan, having not even tested out what he was going to teach beforehand.
Admin
Well, to be fair not everyone that visits TDWTF is a coder by profession. I'm a network geek but still like the stories. And I wouldn't have known that you can break comments across lines without installing an IDE and testing it myself.
But then again I'm an idiot :)
Admin
When you have three perpendicular axes, both left/right handedness AND the names you give to those axes are completely arbitrary.
Maths doesn't stop working just because you called something X that someone else called Y.
The real WTF is that you seem to understand coordinate systems, yet it hasn't occured to you that left/right x/y/z doesn't actually matter even in the slightest, so long as it is consistently applied.
Admin
Yeah, like letting a middle-school student learn to play the pipe organ or take the part of Hamlet in a school play or learn ancient Greek.
I think you are assuming that this particular middle-school student has never had any exposure to programming and computer science before learning C. I doubt that this is the case. Some parents and schools do allow children who take interest in a field to excel in it at an early age.
Admin
Mr Stanthorpe... is that you?. Have you been stalking me all this time?
Admin
For example, when you're doing plain C, you tend to see this used a lot for #define in certain libraries and codebases.
Ditto in the many UNIX shells, +newline is generally used to "escape" the newline away.
Admin
There might also be a simpler assumption that learning C is a bad way to start learning to program. This is incorrect.
Other languages are also good ways to start learning to program, but C is a fine first language. The hard part is learning to program, not learning one syntax or another. Any general-purpose language that's actually used to write real programs is probably a good language to start learning with. Mostly it's down to the teacher and the student, not the language.
(this would exclude toy languages like LOGO and web-specific languages like PHP, as well as hipster affectations like Haskell and other esoterics, but it would include C, Lisp, Java, Ruby, and so forth)
Admin
C is clearly an excellent language to start them off on... separate the wheat from the chaff early, and don't lull a bunch of morons into a false sense of capability by using something like Java.