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 242,860 of 243,242   
   Tim Rentsch to Keith Thompson   
   Re: VAX   
   06 Jan 26 21:14:48   
   
   From: tr.17687@z991.linuxsc.com   
      
   Keith Thompson  writes:   
      
   > Michael S  writes:   
   >   
   >> On Mon, 04 Aug 2025 12:09:32 GMT   
   >> anton@mips.complang.tuwien.ac.at (Anton Ertl) wrote:   
   >   
   > [...]   
   >   
   >>> typedef ump unsigned _BitInt(65535);   
   >   
   > The correct syntax is :   
   >   
   > typedef unsigned _BitInt(65535) ump;   
   >   
   >>> ump sum3(ump a, ump b, ump c)   
   >>> {   
   >>>    return a+b+c;   
   >>> }   
   >   
   > [...]   
   >   
   >> 1.  Both gcc and clang happily* accept _BitInt() syntax even when   
   >> -std=c17 or lower.  Is not here a potential name clash for existing   
   >> sources that use _BitInt() as a name of the function?  I should think   
   >> more about it.   
   >   
   > In C17 and earlier, _BitInt is a reserved identifier.  Any attempt to   
   > use it has undefined behavior.  [...]   
      
   Not so.  The C standard says if a program declares or defines a   
   reserved identifier (in a context where it is reserved) then the   
   behavior is undefined.  The C standard does /not/ say that simply   
   using (as opposed to declaring or defining) a reserved identifier   
   has undefined behavior (in any context).   
      
   The C23 standard is different, but I believe what it says is   
   consistent with the previous paragraph.   
      
   Furthermore it is always possible to use any reserved identifier   
   in a way that has defined behavior, as for example:   
      
     #include    
      
     #define XX(a) X(a)   
     #define X(a) #a   
      
     #define show(a) printf( "The id %s expands to %s\n", X(a), XX(a) )   
      
     int   
     main( int argc, char *argv[] ){   
         show( _BitInt );   
         return  0;   
     }   
      
   This program works without complaint under all of C90, C99, C11, and   
   C17.   
      
   --- 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