[pooma-dev] enums vs. static data members
Mark Mitchell
mark at codesourcery.com
Sun Mar 25 02:12:25 UTC 2001
>>>>> "Julian" == Julian Cummings <cummings at cacr.caltech.edu> writes:
Julian> the expression "(wildcard==1)" being passed as a template
Julian> argument to these functions. The aCC alternately
Julian> complains that either "wildcard" is not defined in the
Julian> current context or that there is no appropriate operator==
Julian> defined to evaluate the expression.
I'm not sure what would cause the former problem, but the second
complaint is most likely bogus. Conversion from an enumeration type
to an integer type is an integral promotion, and, as such, a "usual
arithmetic conversion". However, if there were weird template
`operator==' functions in scope, that could prompt this problem,
perhaps.
Julian> I hate using these enums because different compilers seem
Julian> to treat them differently. An alternative would be to
Julian> define a static bool "wildcard" in these classes, set it
Yes, that is definitely cleaner. Old compilers will not accept this,
but I don't think we care anymore.
Julian> static variables. You can't just stick this in the class
Julian> definition.
Well, that's pedantically true. Most compilers will let you slide by
without defining the static data member, but you should do it anyhow.
--
Mark Mitchell mark at codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
More information about the pooma-dev
mailing list