Silly syntax

Conor P. Cahill cpcahil at virtech.UUCP
Sat Oct 7 23:19:13 AEST 1989


In article <9604 at attctc.Dallas.TX.US>, bobc at attctc.Dallas.TX.US (Bob Calbridge) writes:
> 	switch (expression) {
> 		case f1():	do_this();
> 
> where f1...fn() may be functions that evaluate circumstances and return an
> integer or get input from the user and return an integer.

This is not allowed.  The expression in a case statement MUST be a constant
expression.  A function call is not a constant.

It looks like you are back to the old if-then-else stuff.

-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+



More information about the Comp.lang.c mailing list