From: Nigel Stephens Date: Wed, 16 Nov 1994 12:10:58 GMT To: Aaron Ucko Cc: djgpp AT sun DOT soe DOT clarkson DOT edu, milgram AT eng DOT umd DOT edu Subject: Re: exit() References: <01HJIJL4YMRI003XH1 AT VAX1 DOT ROCKHURST DOT EDU> Aaron Ucko (UCKO AT VAX1 DOT ROCKHURST DOT EDU) writes: > >I notice in djgppstd.h 'exit' is declared 'volatile void'. My understanding > >is that per ANSI 'exit' is just void. Is there some reason for adding the > >'volatile' type in djgpp? > > So that GCC won't complain about your function not returning a value. If this > is really a problem, it generally works to add -Dvolatile= to your flags (I > had to do this to compile nethack, for instance--now I'm trying unsuccessfully > to get it to work with Xlibemu. It almost does!) Using volatile was the way that earlier versions of GCC did it, but it is not compatible with ANSI C. In more recent versions (certainly 2.5 onwards) the "approved" way to declare that a function never returns is to attach the GNU-specific "noreturn" attribute, e.g. void exit(int) __attribute__ ((noreturn)); _________________________________________________________________________ Nigel Stephens, Algorithmics Ltd, 3 Drayton Park, London, N5 1NU, England phone: +44 171 700 3301 fax: +44 171 700 3400 email: nigel AT algor DOT co DOT uk