[asterisk-dev] diruggles: branch 1.6.0 r232811 - /branches/1.6.0/apps/app_externalivr.c

Tony Mountifield tony at softins.clara.co.uk
Fri Dec 4 04:16:19 CST 2009

In article <E1NGCyQ-0005Ep-Fs at wibble.digium.internal>,
SVN commits to the Digium repositories <svn-commits at lists.digium.com> wrote:
> +	if (child_stdin[0] > -1) {
> +		close(child_stdin[0]);
> +	}

A really trivial point, but it always looks weird to me saying

if (fd > -1)

instead of just

if (fd >= 0)

Although they are effectively the same, and I've seen the former in many
places in the Asterisk code, the latter seems more visually consistent with
the concept that valid FDs start at 0 (rather than "start after -1").

Perhaps I just learnt to program in an era where comparisons with zero
were cheaper than comparisons with a number! :-)

Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org

More information about the asterisk-dev mailing list