Skip to content

Mike's home page

Category: 2 cent tips

Always do equality check with rvalue on the left

2011-11-232011-11-23 by mike

A common error in many languages is accidentally omitting an equals sign where a comparison was intended. Example; void somefunc(int i) { if (i = 2) { // was supposed to be “(i == 2)” // … } else { // … } } What makes it easily missed is that it compiles and executes […]

Continue reading
Posted in 2 cent tips

Categories

  • Amusement
  • Computing
    • Apps
    • Programming
      • 2 cent tips
      • CS 371P
      • emacs
      • scripts
      • shell
  • Diving
  • Misc
  • Quotes
  • Science
  • Trading

Archive

  • 2019
  • 2018
  • 2017
  • 2016
  • 2015
  • 2014
  • 2013
  • 2012
  • 2011
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • 2002
  • 1999
© 2025 Mike's home page | Powered by WordPress | Theme: responsive-kubrick by Glam.Ink