home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c      Meh, in C you gotta define EVERYTHING      243,242 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 241,441 of 243,242   
   Keith Thompson to Scott Lurndal   
   Re: bugprone-switch-missing-default-case   
   23 Oct 25 16:21:47   
   
   From: Keith.S.Thompson+u@gmail.com   
      
   scott@slp53.sl.home (Scott Lurndal) writes:   
   > David Brown  writes:   
   >>On 23/10/2025 18:15, Thiago Adams wrote:   
   >>> On 10/23/2025 12:06 PM, David Brown wrote:   
   >   
   >>People do this regularly.  Personally, I usually prefer to have the   
   >>"last", "max", or "count" indicator outside the enumeration :   
   >>   
   >>	enum E1 { A, B, C, D };   
   >>	static const int count_of_E1 = D;   
   >   
   > D has the value '3', yet there are four elements in the   
   > set.  Perhaps the name should be count_of_E1_minus_1?   
   >   
   > How do you use count_of_E1 in this case?   
   >   
   > Too bad 'sizeof' doesn't work on typed enums.   
      
   sizeof works just fine on typed enums.  It just doesn't tell you how   
   many members it has.   
      
   --   
   Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com   
   void Void(void) { Void(); } /* The recursive call of the void */   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca