From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII X-Google-Thread: fc89c,cf7b099c99ee894b X-Google-Attributes: gidfc89c,public X-Google-Thread: f678f,cf7b099c99ee894b X-Google-Attributes: gidf678f,public X-Google-Thread: fee84,cf7b099c99ee894b X-Google-Attributes: gidfee84,public From: baynes@ukpsshp1.serigate.philips.nl (Stephen Baynes) Subject: Re: Digital Unix message queue programming problem!! Date: 1997/02/28 Message-ID: #1/1 X-Deja-AN: 222063620 Sender: news@ukpsshp1.serigate.philips.nl (account for localnews) References: <33162B5F.437B@silicon.net.my> <857065180snz@genesis.demon.co.uk> <01bc2556$de0d73d0$5a6480c2@5-02190> Followup-To: comp.unix.osf.osf1,comp.unix.programmer,comp.unix.osf.misc Organization: Philips Semiconductors, Southampton, UK Reply-To: Stephen.Baynes@soton.sc.philips.com Newsgroups: comp.unix.osf.osf1,comp.unix.programmer,comp.unix.osf.misc 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.