A Genuinely Helpful Warning

I recently noticed this warning when compiling using Flash Builder 4:

"Assignment within conditional. Did you mean == instead of =?"

How great is that? I used to work with a guy (who will go unnamed) who would threaten to sneak onto your machine and remove equal signs from equality tests in your code at random, because “the compiler would never tell you about it”. Thankfully, his evil plan has now been foiled 🙂

Maybe the compiler should also warn about equality tests that are not in conditionals and not on the right hand of an assignment. Would that be useful or annoying?

6 Responses

  1. Yugi says:

    That’s been in the Flash IDE since Flash CS3 came out.

  2. Adrian Parr says:

    It is a bit rubbish isn’t it that an warning message like this is worth blogging about.
    I blogged about it too last year.

    Announcement: Flash CS3 displays a useful compiler warning message!
    http://www.adrianparr.com/?p=81

    It just goes to show how un-specific most of the warnings and error messages are in Flash. I wish this could be improved in future versions of Flash.

  3. dVyper says:

    It’s all well and good bragging about how you knew this before but if you think about it, the fact that he’s only blogging this now means that he hasn’t made such a silly mistake until now, proving his coding superiority. In your faces mwahahaha!

    …ahem.

  4. SP says:

    It’s a shame that if you disable the warning mode in the flash compiler you get 6 or 7 times faster compilation time for large projects… So no more use for that over here.

  5. diego says:

    did that same guy used to change your ipod’s language to chinese?
    does his name start with ‘s’ and end with ‘tan’ by any chance!

    d!

  6. Only people who do not have enough experience in programing will Notice this reasonable and completely right message – like a some kind of “annoying”.

    For experience programmer it is obvious that “==” means COMPARE, and “=” means ASSIGN value.

Leave a Reply

Your email address will not be published. Required fields are marked *