Must the "switch" quantity be an integer?

Doug Gwyn gwyn at smoke.BRL.MIL
Thu Oct 20 20:03:54 AEST 1988


In article <9711 at haddock.ima.isc.com> karl at haddock.ima.isc.com (Karl Heuer) writes:
-In article <8706 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn) writes:
->If you really have to have os_t*-shaped magic numbers, consider ...
->	#define BUFPTR (&dummy_buf)
->	case (ptrint_t)BUFPTR:
-C'mon Doug, you know better than that.  That isn't a valid integral constant
-expression.

But it's an allowed extension (approved at September X3J11 meeting)
and is the best he'll be able to do along these lines.  There is no
fully portable way to use a switch expression for this.



More information about the Comp.lang.c mailing list