[Asterisk-Dev] "true" is -1 or 1 in boolean functions ?

Derek Smithies derek at indranet.co.nz
Wed Jan 18 14:39:49 MST 2006


Hi,
On Mon, 16 Jan 2006, Tilghman Lesher wrote:

> On Monday 16 January 2006 04:59, Luigi Rizzo wrote:
> > i notice some inconsistency in the return values for
> > functions that have a boolean result - some pieces of code
> > use -1, others use 1.

> 
Perhaps the real question is:

  why are we returning 1 or -1?

Surely, these are magic numbers, a coding style that is (generally) not
approved.

A quick web search shows many many coding guidelines that say,
  "never use magic numbers"

perhaps someone can provide some information that explains why these magic 
numbers are acceptable.

Derek.
-- 
Derek Smithies Ph.D.                 Any fool can write code that 
IndraNet Technologies Ltd.                a computer can understand.        
Email: derek at indranet.co.nz         Good programmers write code 
ph +64 3 365 6485                          that humans can understand.
Web: http://www.indranet-technologies.com/            Martin Fowler




More information about the asterisk-dev mailing list