Reply to post: Is it my age ?

Good news: Samsung's Tizen no longer worst code ever. Bad news: It's still pretty awful

JimmyPage Silver badge
Boffin

Is it my age ?

First off, the example shown is *not* "comparing a variable with itself", it's returning the result of comparing a variable with itself.

Second off, that's not as crazy as it seems ... I have memories of such tricks being used to stand in for "return 1;" or "return true;" - particularly if you want to obfuscate assembler.

Thirdly (although it is BAAAAAD) practice, bear in mind that in some situations/languages, referencing a variable can actually run code (which could change the value of something somewhere).

All of that said, part of writing good code is it should make intuitive sense, which doesn't really apply in those 3 situations

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon