[m-dev.] enumeration naming convention (was: direct retry)

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Oct 16 19:10:27 AEDT 2000


On 16-Oct-2000, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> On 16-Oct-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > For documentation purposes, rather than making the field be of type
> > MR_int_least8_t, I would suggest using a typedef for MR_int_least8_t,
> > with the typedef being declared at the same point where the enum is
> > declared.  You could name the int_least8_t typedef `MR_EvalMethod' and
> > leave the enum as just `enum MR_eval_method' or typedef'd to
> > `MR_EvalMethodEnum'.
> 
> I'll go with the opposite convention, with MR_EvalMethod still being the enum
> and a new type MR_EvalMethodInt which is typedef'd to MR_int_least8_t.

OK, that's fine with me.  I'd just like us to adopt a consistent naming
convention for enumerations and their corresponding integer types,
since this issue comes up quite often.  So I propose we adopt the above
naming convention, formalized like so:

	Enumeration types are always typedef'd and have names of
	the form `MR_Foo'.  For each enumeration type where we want
	need to have control over the representation, we also define
	a typedef `MR_FooInt' which is a typedef for some integer type,
	normally an explicitly-sized one such as `MR_Integer' or
	`MR_int_least8_t'.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list