• StuffIt (unregistered)

    FIRST! BRILLANT! BRILLANT FIRST!

  • Jules (unregistered)

    Of course the l33t haxors may have stolen your code, seen this gem, and been scared off... in which case it did its job admirably.

  • Jan (unregistered)

    Writing your code like that is a sure way to make sure it doesn't get stolen.

  • Link8312 (google)

    Why wouldn't it do anything? Does VB always treat "if someBoolean=true" as "if someBoolean<>false" ? Because I clearly remember warnings about about remembering to pass VARIANT_TRUE instead of TRUE when calling VB functions from C using COM.

  • Vault_Dweller (unregistered)

    Uhmm, your last link is to the Champions Trophy, not the Confederations Cup. You fail as a spambot

  • Someone (unregistered) in reply to StuffIt

    Come on, man, it's "FRIST". Also, the article says "lead" rather than "led", if that concerns you.

    For some reason I have a pressing urge to check out the FIFA Confederations Cup 2017, even though I don't really know what that is. Strange.

  • Pietro Gagliardi (andlabs) (unregistered) in reply to Link8312

    And you would be right! According to both Raymond Chen (https://blogs.msdn.microsoft.com/oldnewthing/20041222-00/?p=36923) and Eric Lippert (https://blogs.msdn.microsoft.com/ericlippert/2004/07/15/not-logical-is-vbscript/), people who wrote 'boolValue = True' in VB were in for a nice surprise if some interop code screwed up and didn't use VARIANT_TRUE (whose numeric value is -1) in their VARIANT_BOOLs. So in reality, the code in the post could take that third branch (because they are comparing to True explicitly)... just not because of a hacker. Yay COM!

  • Clint (unregistered)

    omfg 5p4mb07 4l3r7

  • operagost (unregistered)

    Raymond Chen's blog is like TVTropes for developers.

  • Hannes (unregistered)

    Of course boolean can hold some other value than TRUE or FALSE: FILE_NOT_FOUND!

    Also, maybe I should watch the Confed Cup after all. I've seen some nice ads for it lately.

  • Herby (unregistered)

    Sorry, REAL football is played with guys in helmets and pads, with a pointy ball. None of this wimpy round ball no touchy stuff.

  • footballerwithfeet (unregistered) in reply to Herby

    No, that's US handball. They call it football, but they are clearly using their hands. :D

    Also I think reCaptcha needs to fetch their intern from the cofveve machine and make him fix their stuff.

  • Auction_God (nodebb)

    Not to mention that another thread (unlikely in VB) could change the value of "var" between the first test (from false to true), so that the third error branch is taken.

  • Drew (unregistered) in reply to Herby

    Real football (or footy) is played by real men without pads/helmets (but with real take-em-to-the-ground tackling), who don't get to stop for a breather after every 15-second play.

  • Derf Skren (unregistered) in reply to Herby

    As someone pointed out, that's handegg. And it's pretty funny that you mention the form of football that's played with helmets and pads when there are at least 3 variants where the players are not protected like that.

  • Mistakes in an article about mistakes (unregistered)

    So unless the spam goes away I will

  • Dave (unregistered)

    I write code that's run in high-radiation environments. It's quite possible for booleans to end up with values that are neither TRUE nor FALSE, and the code does check for this and fall back to the last checkpoint and retry. So it's not always a WTF.

  • bvs23bkv33 (unregistered) in reply to Someone

    following you logic Paola should be Ben, not Bean

  • Flips (unregistered)

    isFalse(boolvar) { retun sql_escape_string(Boolean.toString(boolvar)) != sql_escape_string(Boolean.toString(!false)) ; }

    I always use this one to protect against hackers:D

  • Quite (unregistered) in reply to Herby

    I take your "real" "football" and raise you Rugby football. That's like your American football but without the helmets and pads. (Yeah, some of the guys do wear some padded headgear, and you also see the occasional gum-guard, but none of that mini-tank stuff.

    And if you really feel fit, I offer you Aussie Rules football.

  • Alex (unregistered) in reply to Dave

    That must be awesome. Code for an untrustable environment, probably heaven for any paranoid nerd.

  • anonymous (unregistered) in reply to Drew

    Association football (soccer) actually use pads, but the pads are hidden inside their socks

  • ksgindia (unregistered)

    Great sharing!please keepsharing. http://www.ksgindia.com/index.php/about-us/ksg-branches/jaipur-rajasthan

  • CRConrad (unregistered) in reply to footballerwithfeet

    Hand-egg, actually. Balls are round; that thing they throw around with their hands isn't.

  • Hydranix (unregistered) in reply to CRConrad

    Mine aren't round, much more closely resembling an egg than anything round.

  • David Calman (unregistered)

    I'm not familiar with VB, but doesn't a single equals sign mean 'gets'?

Leave a comment on “Classic WTF: Hacker Proof Booleans”

Log In or post as a guest

Replying to comment #:

« Return to Article