[M3devel] Posix < 0 vs. # 0 vs. = -1?
Tony Hosking
hosking at cs.purdue.edu
Sun Apr 18 21:09:00 CEST 2010
Checking < 0 is much cheaper than checking = -1.
C idioms typically check < 0.
-1 is simply a convenient negative value to return.
Leave it as is.
On 18 Apr 2010, at 09:57, Jay K wrote:
> Posix often says:
> function foo() returns 0 for success, -1 for error
>
> m3core/libm3/etc, often say if foo() < 0 or if foo() # 0 "instead".
> Generally ok to tighten these up to "= -1", perhaps upon checking manpages,
> or a known rat's nest of inconsistencies?
>
> - Jay
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100418/dd483b74/attachment-0002.html>
More information about the M3devel
mailing list