On Tue, 2005-05-24 at 20:27 -0400, DJ Delorie wrote: > > This is still not an answer to the question I originally asked - do you > > see any way IN C to write code which has the relevant property of the > > class above (that is, that the FOOmode constants are not accessible > > except to authorized code) and which does not rely on free conversion > > between enumeration constants and integral types? > > enum { > TVQ_BAR_GRILL = (DATESTAMP % 10), > TVQ_NEXT2, > TVQ_NEXT3, > TVQ_NEXT4 > } TheValQuux; > > It's evil, but it will keep programmers from hard-coding integer > constants anywhere. The "constants" will need to be different every > day.
This doesn't do what I want at all. The goal is to make the *symbolic enumeration constants* inaccessible to most code. Think about how machine_mode values are used. Almost the entire compiler is supposed to treat them as opaque things. You get them from e.g. int_mode_for_size; you may iterate over a class with GET_MODE_WIDER_MODE; you stash them in RTL and you pass them to predicates. Appearances of "SImode" in the machine-independent compiler are usually bugs. This is a major contributing factor to the brokenness of ports that don't set BITS_PER_UNIT==8. The goal is to make "SImode" and its friends inaccessible in the machine-independent compiler, so that that category of bugs cannot arise. zw