From: Keith.S.Thompson+u@gmail.com   
      
   Tim Rentsch writes:   
   > Keith Thompson writes:   
   [...]   
   >> The header was introduced in C99. In C99, C11, and C17,   
   >> that header defines char16_t and char32_t. C23 introduces char8_t.   
   >>   
   >> There doesn't seem to be any way, other than checking the value of   
   >> __STDC_VERSION__ to determine whether char8_t is defined or not.   
   >> There are not *_MIN or *_MAX macros for these types, either in   
   >> or in . A test program I just wrote would have   
   >> been a little simpler if I could have used `#ifdef CHAR8_MAX`.   
      
   [...]   
      
   > Since C23 defines char8_t to be the same type as unsigned char,   
   > it seems better to just define it when it isn't there:   
   >   
   > #include    
   >   
   > #if CHAR_BIT == 8 && __STDC_VERSION__ < 202311   
   > typedef unsigned char char8_t;   
   > #endif   
      
   Yes. And the test for CHAR_BIT may not be necessary, depending on the   
   programmer's intent. char8_t is the same type as unsigned char even if   
   CHAR_BIT > 8. Similarly, char16_t and char32_t are the same type as   
   uint_least16_t and uint_least32_t, respectively.   
      
   But before C23, u8"a" is a syntax error.   
      
   --   
   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)   
|