comp.lang.c
[Top] [All Lists]

Re: case labels

Subject: Re: case labels
From: CBFalconer
Date: Fri, 28 Mar 2008 19:47:31 -0500
Newsgroups: comp.lang.c

"christian.bau" wrote:
> aark...@xxxxxxxxx wrote:
> 
>> why are constant integer expressions required in case labels of
>> the switch statement? what would be the impact of allowing
>> general integer expressions instead of constant integer
>> expressions? discuss both user convenience and implementation
>> aspects?
> 
> Consider
> 
>   switch (i) {
>     case f (): printf ("f"); break;
>     case g (): printf ("g"); break;
>   }
> 
> Discuss under user convenience, implementation, and general
> mental health aspects.

The function f() is not a constant integer expression.  Illegal.

-- 
 [mail]: Chuck F (cbfalconer at maineline dot net) 
 [page]: <http://cbfalconer.home.att.net>
            Try the download section.



-- 
Posted via a free Usenet account from                                 www.teranews.com">http://www.teranews.com


<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy