Re: Header files with enums instead of defines?
From: Peter Pentchev (roam_at_ringlet.net)
Date: 12/22/04
- Previous message: Peter Jeremy: "Re: Header files with enums instead of defines?"
- In reply to: Peter Jeremy: "Re: Header files with enums instead of defines?"
- Next in thread: Peter Edwards: "Re: Header files with enums instead of defines?"
- Reply: Peter Edwards: "Re: Header files with enums instead of defines?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 22 Dec 2004 12:38:44 +0200 To: Peter Jeremy <PeterJeremy@optushome.com.au>
On Wed, Dec 22, 2004 at 08:08:55PM +1100, Peter Jeremy wrote:
> On Wed, 2004-Dec-22 11:31:43 +1030, Greg 'groggy' Lehey wrote:
> >Has anybody thought about replacing #defines with enums in header
> >files? It would make debugging a whole lot easier. Foe example, I'm
> >currently looking at a debug printout which contains:
> >
> > xerrno = 17,
> ...
> > xerrno = EEXIST,
>
> K&R2 states that errno is an "integer expression" and that the error
> values are "macros". I suspect POSIX and newer C standards say something
> similar.
The Single Unix Specification goes to great pains to repeat over and
over again that the error codes are 'symbolic constants', which IMHO
may be taken to mean either a #define'd macro or an enum value.
I, too, went to check with more than half a hunch that it would mandate
that the error codes be macros, but it turned out it doesn't :)
Still, all the other objections about enums not really being ints
are quite valid :)
G'luck,
Peter
-- Peter Pentchev roam@ringlet.net roam@cnsys.bg roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 If you think this sentence is confusing, then change one pig.
- application/pgp-signature attachment: stored
- Previous message: Peter Jeremy: "Re: Header files with enums instead of defines?"
- In reply to: Peter Jeremy: "Re: Header files with enums instead of defines?"
- Next in thread: Peter Edwards: "Re: Header files with enums instead of defines?"
- Reply: Peter Edwards: "Re: Header files with enums instead of defines?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
- Re: macro for enum to string?
... > Why a macro? ... > int main ... This macro converts the
name of an enumeration to string but it is not ... The solution that Jeff proposed works
only if the enum values start from ... (comp.lang.cpp) - Re: Declaration, Definition & Reference listers for C
... > union, enum, macro, variable and function} {declaration, definition and
... (comp.compilers) - Re: good Embedded C resources plz...
... Not as good type checking as const, but when enums work they can be ... caught
at compile time and can be replaced with a variable or a macro ... Correct, and unless
memory is being exhausted, this is not necessarily ... (comp.arch.embedded) - Re: Declaration, Definition & Reference listers for C
... > union, enum, macro, variable and function} {declaration, definition and
... (comp.compilers) - Re: trying to access enum from one object in another
... "myEnum") when using a function call in to another object ... The enum
is actually off of Persist, ... m_IEUtil.Import enumObjectType.myEnum, sParam2, sParam3
... give details of what is happening, error codes etc ... (microsoft.public.scripting.wsh)