Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
From: baynes@ukpsshp1.serigate.philips.nl (Stephen Baynes)
Subject: Re: Digital Unix message queue programming problem!!
Date: 1997/02/28	[thread overview]
Message-ID: <E6BCpw.CEz@ukpsshp1.serigate.philips.nl> (raw)
In-Reply-To: 01bc2556$de0d73d0$5a6480c2@5-02190

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1067 bytes --]


Andy Knight (KnighA@tetraworld.com) wrote:
: > Why -1? C defines 0, EXIT_SUCCESS and EXIT_FAILURE.

: Could you explain this statement to me?

: The X/Open Portability Guide says about msgget() that "On successful
: completion, the function msgget() returns a non-negative integer, namely a
: message queue identifier; otherwise it returns -1 and errno is set to
: indicate the error".

: Given that definition I would personally test for < 0 rather than == -1 but
: its hard to criticise the explicit test.

If you had not cliped the line before th eone you quoted it would be obvious. 
The missing line is:

           exit (-1);

So the program exit status is being talked about. Not the exit status from 
msgget().


--
Stephen Baynes    MBCS  CEng                Stephen.Baynes@soton.sc.philips.com
Philips Semiconductors Ltd                  
Southampton SO15 0DJ                        +44 (01703) 316431
United Kingdom                              My views are my own.
Do you use ISO8859-1? Yes if you see � as copyright, � as division and � as 1/2.



  reply	other threads:[~1997-02-28  5:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-02-27  5:00 Digital Unix message queue programming problem!! Kok Fock Seng
1997-02-27  5:00 ` Jeremy D. Levine
1997-02-27  5:00 ` Lawrence Kirby
1997-02-28  5:00   ` Andy Knight
1997-02-28  5:00     ` Stephen Baynes [this message]
1997-02-27  5:00 ` Kok Fock Seng
1997-02-27  5:00 ` Charles M Richmond
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox