Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 May 2010 22:36:11 +0300
From:      Eitan Adler <lists@eitanadler.com>
To:        hackers@freebsd.org
Subject:   proposed change to style(9): require yoda style if statements
Message-ID:  <AANLkTimCLELSQ9YNZ403_PLhKOQCQTcl9H1bfb1ccRNb@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
My proposal is simple:
require that any if statement that compares a constant to a mutable variable
be written as
if (constant == variable)
instead of
if (variable == constant)

this prevents an extremely common programming error
if (variable = constant)

While this is almost always found in testing sometimes thing can slip
through and writing it using the former method will generate a compiler
warning.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTimCLELSQ9YNZ403_PLhKOQCQTcl9H1bfb1ccRNb>