• (nodebb)

    I like to touch files in all the inappropriate ways. Does that make me a phile?

  • (nodebb)

    Does that make me a phile?

    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

  • Dave (unregistered) in reply to Mr. TA

    Just as long as you aren't a pdf-phile...

  • Prime Mover (unregistered) in reply to Steve_The_Cynic

    You say "Touch of Grey", I say "Touch of Cloth" ...

    https://en.wikipedia.org/wiki/A_Touch_of_Cloth

  • (author)

    I almost went with…

    https://youtu.be/ZebKhabJItE?t=569

  • Anonymous') OR 1=1; DROP TABLE wtf; -- (unregistered)

    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.

  • Vuvuzela (unregistered)

    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

  • Anon (unregistered)

    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

  • (nodebb) in reply to Anon
    the system("rm ...") also points that this is a Windows app.
    If this was running on Windoze, "rm" should have been "del". "rm" is almost definitely calling the utility on a Unix-like OS (Linux, iOS, etc.)
  • (nodebb) in reply to Anon

    the system("rm ...") also points that this is a Windows app.

    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.

  • RLB (unregistered)

    How about touch atouchatouchme?

  • Brian Boorman (google)

    File should have been named è

    touch è

  • fa (unregistered)

    "[...] 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.

  • (nodebb) in reply to Nutster

    Are we really still calling it "Windoze" in 2021?

  • Carl Witthoft (google) in reply to alphajbravo
    Are we really still calling it "Windoze" in 2021?

    What would you prefer? Wine-douse? Windozen't ? I'd go with ThatHeapOfCrapThatStillDoesntUnderstandInodes

  • Klimax (unregistered) in reply to Carl Witthoft

    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)

  • (author) in reply to Vuvuzela

    Anything that makes me go "ugh, I'd hate to inherit that!" is grounds for a WTF.

  • (nodebb)

    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.

  • Prime Mover (unregistered) in reply to Klimax

    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.

  • eric bloedow (unregistered)

    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!

  • Royal Stitches (unregistered)
    Comment held for moderation.
  • MiserableOldGit (unregistered) in reply to eric bloedow

    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.

  • (nodebb) in reply to eric bloedow

    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!

    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.

  • (nodebb) in reply to Anonymous') OR 1=1; DROP TABLE wtf; --

    " 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.

  • Geri (unregistered) in reply to Prime Mover

    You say "Touch of Cloth", I say "Touch Mahal" ...

    https://en.wikipedia.org/wiki/Taj_Mahal

  • Some Ed (unregistered) in reply to Carl Witthoft

    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.

Leave a comment on “Touch of Death”

Log In or post as a guest

Replying to comment #:

« Return to Article