Oh The Irony



  •  Yesterday, I enabled Strict Warnings in Firebug, just to see what happens. Among other things, it will display a warning about typing = (assignment) inside the condition for an if or while, warning about a possible mistype.

    I found myself wondering why it would warn about that kind of trifle, finding it unnecessary. With a dismissive frown and the beginnings of an arrogant smirk, I disabled Strict Warnings again.

     

    Today, I had a troubled PM and an angry client with a couple thousand users because I had mistyped == as = in an if statement, returning true all the time.

     

    Take heed, my friends, take heed.



  • @dhromed said:

    I found myself wondering why it would warn about that kind of trifle, finding it unnecessary.
    Every C compiler I've used can issue that as a warning, as will the official PHP interpreter. If you actually need to legitimately do it, usually something like
    while (NULL != (d = readdir(dh)))
    will make the checker happy.


  • Discourse touched me in a no-no place

    @Lingerance said:

    while (NULL != (d = readdir(dh)))
    The more sensible ones will accept (and reccomend) the less verbose

    while ( (d = readdir(dh)) )

    (Spaces optional, negation where required goes in the outer two left parens.) Easily recognisable once you've been exposed to it for a while.


Log in to reply