- 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
I like to touch files in all the inappropriate ways. Does that make me a phile?
Admin
Perhaps it makes you a filephile...
And I'd have called the file to touch, um, er, "ofgrey".... Er. the command becomes
touch ofgrey
https://en.wikipedia.org/wiki/Touch_of_Grey
Admin
Just as long as you aren't a pdf-phile...
Admin
You say "Touch of Grey", I say "Touch of Cloth" ...
https://en.wikipedia.org/wiki/A_Touch_of_Cloth
Admin
I almost went with…
https://youtu.be/ZebKhabJItE?t=569
Admin
This code is bad not because it's written in C but just because it's bad code. You could write a main loop like this in any language.
Some of the biggest challenges in unit testing C and C++ is that all functions are non-virtual by default and can't be overridden in tests (unless you do some really heinous linker hacks which are highly inadvisable, and even then that won't help with inlined functions). In languages like Java, all functions are virtual and can be overridden/mocked by tests (if not marked final); in languages like Python with duck typing, you can also override what you need for testing.
In C++, you need to plan for testing by making anything you want to mock virtual, which can introduce a small performance overhead (though that's unlikely to matter in the vast majority of code). Similarly in C, you have to do the C equivalent of virtual functions by using function pointers in all of the places you want to be able to override behavior and then have the test framework set those to its desired test behavior.
Admin
So what is the WTF there? Incomplete documentation? By that rule 99% of the existing software is one giant WTF. Wait, make it 99.9%. You know, it is one giant WTF. cries
Admin
Looks like a Windows' message loop, get_msg and process_msg should have been designed to handle either part of the loop or the test, the system("rm ...") also points that this is a Windows app.
I always considered the Windows' message loop a WTF in itself.
https://en.wikipedia.org/wiki/Message_loop_in_Microsoft_Windows
Admin
Admin
Actually, it indicates a unixish app, since the command to delete a file in Windows is
del
...Addendum 2021-05-05 08:54: Bah, ninjaed.
Admin
How about touch atouchatouchme?
Admin
File should have been named è
touch è
Admin
"[...] you'd find yourself staring at a program that refuses to exit, but also isn't using any meaningful quantities of CPU [...]"
Seems that it would saturate one core, with a busy loop. I agree that it's not "meaningful" to do that, but it's a strange way to put it.
Admin
Are we really still calling it "Windoze" in 2021?
Admin
What would you prefer? Wine-douse? Windozen't ? I'd go with ThatHeapOfCrapThatStillDoesntUnderstandInodes
Admin
I think that some people need to be banned from ever posting about Windows until they demonstrate they actually understand topic. For you, you have absolutely no understanding of Windows internals whatsoever and thus are posting complete falsehoods. Of course there is equivalent of Inode. (https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2003/cc781134(v=ws.10)?redirectedfrom=MSDN#ntfs-file-record-attributes) It is just more capable...
Stop posting misinformation about Windows and read on its internals in Windows Internals books. (https://docs.microsoft.com/en-us/sysinternals/resources/windows-internals)
Admin
Anything that makes me go "ugh, I'd hate to inherit that!" is grounds for a WTF.
Admin
The bad part is that once
inFile
gets into a state where you can't read from it any more, the code switches to being a busy-loop spread over two functions.Admin
Not a big fan of freedom of speech, then? You can paint it whatever colour you like, a turd is still a turd, and so is Windows.
Admin
i seem to remember an old story where a programmer never heard of the END function, so he would do an intentional "divide by zero" to end his programs!
Admin
Hmm, I think I used to work for that guy ... he used to wang about windows and VB and stuff as well, whilst simultaneously being proof you can create hopeless atrocities in C++ on any platform you (or he) chose.
Admin
I see you aren't familiar with ASP.Net's Response.End throwing a ThreadAbortException. Yes, that what Response.End does and it does it so that the rest of the processing pipeline gets skipped.
Admin
" all functions are virtual and can be overridden" -- There are estimates that writing a class that supports inheritance (i.e. can e used as a base class) is 50 to 100 times harder than writing a class which is sealed.
Admin
You say "Touch of Cloth", I say "Touch Mahal" ...
https://en.wikipedia.org/wiki/Taj_Mahal
Admin
I like how your big problem with Windows is that they call the thing in their filesystem that corresponds to a unix inode something different. Windows has the concept, they just don't call it that.
There are lots of valid complains about Windows. I just don't think this is one of them.
For the record, there are lots of valid complaints about Unix, BeOS, and for that matter anything else you can possibly think of. I'm not aware of anything that is problem-free or even WTF-free.