Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^5: Burned by precedence rules (fail() if "false";)

by tye (Sage)
on Dec 28, 2008 at 21:06 UTC ( #732930=note: print w/replies, xml ) Need Help??

in reply to Re^4: Burned by precedence rules (== true)
in thread Burned by precedence rules

Wow, defining your FALSE constant to a value that isn't actually false is such an amazingly bad idea that I never even considered it. Yes, don't define Boolean constants that completely defy your language's concept of "true" or "false". Duh! :) Thanks for mentioning that.

- tye        

  • Comment on Re^5: Burned by precedence rules (fail() if "false";)

Replies are listed 'Best First'.
Re^6: Burned by precedence rules (fail() if "false";)
by gwadej (Chaplain) on Dec 28, 2008 at 21:22 UTC

    I have often said that I have learned as much from the really bad code that I have maintained as I have from the really good code I have maintained. (That applies to both my code and other people's code.)

    If a value of FALSE that is not false doesn't scare you enough, I won't tell you what I found FOUR defined as...<grin/>

    G. Wade

      I still have to say that my favorite maintenance horror is the block that had (including comments) the $language equivalent of

      $x = 1; $x = 1; # Just to be sure



        Some folks (i'm talking about you MidLifeXis) just don't understand humor :)

      No doubt it was originally defined as FOUR = 4, but then somebody was told to change it to 42 or π. This is why I tend to avoid setting constants like THREE = 3. I find it rather annoying to have constants with clear names that lie. After all, complex code is self-obfuscating; it doesn't need any help.

      Information about American English usage here and here. Floating point issues? Please read this before posting. — emc

        Something like that.

        This is why I started using the term magic constants a few years ago to complement magic literals. Everybody agrees that magic literals in code are a bad idea. But, what happens when the constant you chose to replace is with provides no more meaning or abstraction...magic constant.

        A constant like FOUR provides so little information that it would have been better to leave the original literal 4 in the code.

        G. Wade

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://732930]
[1nickt]: stevieb I don;t doubt that there's a difference. BestBuy has "consumer" models only on display.
[ambrus]: 1nickt: for some reason, these days they call every computer "gaming", even ones that gamers wouldn't buy. I've bought a keyboard that was labelled "gamer", despite that it has hard springs and seems to be way better for typing than for gaming;
[1nickt]: I though the gamers like that because they bash the keys so hard.
[ambrus]: and I've seen motherboards with no fast expansion ports for a video card but built-in hardware RAID advertized as "gaming".
LanX has a shaming laptop
[ambrus]: 1nickt: my impression is that the gamers like the softer springs, because fast reaction time is more important to them then feedback from keypresses to recognize typos.
[1nickt]: Ah, I see. I did read some gamer mag reviews, and yes, they lamented the fact that laptops with no discrete video card are sold as "gaming" hardware.
[1nickt]: But, they do have red keyboard backlighting! And gargoyles on the front, or words like "Maxxx" here and there. They know their demographic!
[1nickt]: True gamers don;t buy Dells, HPs, or Lenovos, I think ;-)
[ambrus]: The keyboard I bought doesn't have backlighting. I specifically had to select for that, because so many keyboards these days have lights. Why would I want lights in the keyboard? I want lights in the room, such as on the ceiling, not in the keyboard.

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (13)
As of 2017-03-27 13:44 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.