<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
 > much cheaper<BR>
 <BR>
Ah. I hadn't considered that.<BR>
It looks like we might gain commonality in socket code though by checking for a specific value.<BR>
C:\dev2\cm3.2\m3-libs\m3core\src\win32\WinSock.i3(293):  SOCKET_ERROR   = -1;<BR><BR>
 <BR>
 - Jay<BR> <BR>
<HR id=stopSpelling>
From: hosking@cs.purdue.edu<BR>Date: Sun, 18 Apr 2010 15:09:00 -0400<BR>To: jay.krell@cornell.edu<BR>CC: m3devel@elegosoft.com<BR>Subject: Re: [M3devel] Posix < 0 vs. # 0 vs. = -1?<BR><BR><BASE>Checking < 0 is much cheaper than checking = -1.
<DIV>C idioms typically check < 0.<BR>
<DIV>-1 is simply a convenient negative value to return.<BR>
<DIV>Leave it as is.</DIV>
<DIV><BR></DIV>
<DIV><BR><BR>
<DIV>
<DIV>On 18 Apr 2010, at 09:57, Jay K wrote:</DIV><BR class=ecxApple-interchange-newline>
<BLOCKQUOTE><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: medium Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; WORD-SPACING: 0px" class=ecxApple-style-span>
<DIV style="FONT-FAMILY: Verdana; FONT-SIZE: 10pt" class=ecxhmmessage>Posix often says:<BR> function foo() returns 0 for success, -1 for error<BR> <BR> m3core/libm3/etc, often say if foo() < 0 or if foo() # 0 "instead".<BR> Generally ok to tighten these up to "= -1", perhaps upon checking manpages,<BR>  or a known rat's nest of inconsistencies?<BR><BR> - Jay<BR><BR></DIV></SPAN></BLOCKQUOTE></DIV><BR></DIV></DIV></DIV>                                         </body>
</html>