• Scott Simons (unregistered)

    You may laugh at this, but I've encountered situations on the compact framework where I had to call DoEvents twice to get it to actually work. Never three times though.

  • qwerty (unregistered)

    "you may as well call it once more ... just to be sure" That is great.

    I'm sorry too say that I too have done this kind of thing. I use a Hauppauge DVB TV tuner. Sometimes the TV app starts, sometimes it just doesn't feel like it. My solution: A small app with CreateProcess in a while(1) loop!

  • Centaur (unregistered)

    An old Extreme Programming saying goes, “Three strikes and you refactor”. That means, repeating an operator twice is ok, but if you need it three times, change it into a loop :)

  • Arf arf arf (unregistered)

    This just goes to show why C is a much better language. This popular "say it again loudly and slowly" design pattern can be implemented much more efficiently in C:

    a = a = a = 1;

    Note that this also guards against typos and eases maintenance; imagine making a few changes and ending up with something like this:

    a = 1;
    a = 1;
    a = 2;

    On the other hand, case-blind languages have a distinct advantage in that you can do it with capslock down in cases where you want the compiler to know you REALLY mean business.

    I've heard that the next version of VB.NET will allow multiple exclamation points as statement terminators, but at this point it's just a rumor.

    A = A = A = 1!!!!!1!1!!

  • Adelle Hartley (unregistered)

    I know that looks crazy, but there are times when calling DoEvents will trigger more events, which require a second call to DoEvents in order to be processed. I've never had to call DoEvents more than twice, but I can see how it would happen.

    Of course, the ideal structure here is a While loop:

    While Not CheckIfFinished Or TimeOut
    DoEvents
    Wend

    That'll cover those times when even three DoEvents aren't enough.

  • Daniel Turini (unregistered)

    Sorry to disappoint you, but there are a lot of points where VB 5.0 and VB 6.0 needed several DoEvents in a row to process all the enqueued event.
    It seems that it processed only a few events to try to save a few clock cycles.
    This was actually a common practice for experienced VB programmers to call several DoEvents in a loop or repeated on a single line to circumvent those bugs.

  • Daniel Turini (unregistered)

    Sorry to disappoint you, but there are a lot of points where VB 5.0 and VB 6.0 needed several DoEvents in a row to process all the enqueued event.
    It seems that it processed only a few events to try to save a few clock cycles.
    This was actually a common practice for experienced VB programmers to call several DoEvents in a loop or repeated on a single line to circumvent those bugs.

  • MuteThis (unregistered)

    Daniel Turini,

    Only twice?

  • Daniel Turini (unregistered)

    Go guess... I tried to post this comment using RSS Bandit and it said it failed. When I came here to post the same comment, it was not there. Then, when I posted, it appeared twice.
    Well, on an URL that has "WTF", anything may happen. :)

  • cablito (unregistered)

    Well, I was the guy who submited the code, my colleage, now an ex-employee, used to put DoEvents in between any action or code he believed was "processor intensive".

    There where cases where doevents was needed in VB, but not 3 times in a row;

    He was actually facinated with the new thing I had told him, that you could use multiple statements on the same line with the ':' trick.

    The code would otherwise be:

    Doevents
    Doevents
    Doevents
    Call Tlead1....

  • Jeff Darcy (unregistered)

    There was once a good reason for the hallowed "sync; sync; reboot" on some flavors of UNIX, but I don't think I've ever heard of one for a third repetition.

  • Zka (unregistered)

    I have encountered situations in Delphi, when buggy ADOdb needed two "TADOTable.Insert"-s in a row to stay in dsInsert state. DBAware shame :)

  • Yanman (unregistered)

    The real WTF is that first you say TTC and afterwards you use TCC...What's the difference?

    captcha: appellatio

  • (cs)

    The real WTF is that it took you three and a half years to find out.

  • Coward (unregistered) in reply to Pim

    TRWTF is that you toke 1 year and nearly 4 months to reply to his reply and another while for me to reply to your reply of his reply

  • (cs)

    Can't believe that no one had yet pointed this out, but:

    If "there was never a case when “name” wasn't something it shouldn't have been!", doesn't that mean that the name was never what it should have been?

    Sounds unlikely. Well, unless you had unusual requirements for what a name should be.

Leave a comment on “Do It! Do It! Do It!”

Log In or post as a guest

Replying to comment #:

« Return to Article