lua-users home
lua-l archive

Re: lua.c and OS error codes

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Jun 15, 2007 at 04:35:09AM +0200, Lavergne Thomas wrote:
> On Thu, Jun 14, 2007 at 11:17:44AM -0700, Mark Edgar wrote:
> > Windows apparently supports exit codes from 0 to 4294967295 and POSIX
> > supports exit codes from 0 to 255, but C only supports two exit codes:
> > EXIT_SUCCESS==0 and EXIT_FAILURE, which is a non-zero but otherwise
> > unspecified value.
It's a subtle point, but C doesn't actually require that
EXIT_SUCCESS==0. It just has to have the same _effect_ as 0.
> From my ANSI/C book it seems that return code is an int, and the
> interpretation of his value is implementation defined with just two
> values predefined EXIT_SUCCES and EXIT_FAILURE.
> So ANSI/C also support at least 16bit exit code (least precision
> allowed for int) but this can be more limited due to the implementation
Right, pretty much everything about exit() is implementation-defined,
For example if you use exit(0) there's no guarantee that the actual
numeric value 0 becomes visible anywhere; it just says that some
implementation-defined way of representing "success" is returned to
the host environment.
 -Dave Dodge

AltStyle によって変換されたページ (->オリジナル) /