home bbs files messages ]

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

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

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

   Message 32,731 of 33,346   
   Francis Glassborow to Peter C. Chapin   
   Re: stdint.h and function overloading   
   14 Dec 12 09:01:48   
   
   From: francis.glassborow@btinternet.com   
      
   On 14/12/2012 05:27, Peter C. Chapin wrote:   
   > On 12/13/2012 07:16 PM, Edmund Kapusniak wrote:> Hello,   
   >   >   
   >   >    I have a question about the types in stdint.h.  Are these types   
   >   > guaranteed to be typedefs of one of the 'normal' integer types   
   >   > (e.g.  short, int, long)? Or could a compiler do the following?   
   >   >   
   >   > typedef __compiler_magic_type int32_t;   
   >   
   > My reading of the standard is that the type names introduced in   
   > cstdint are guaranteed to be typedef names. Note that not all types   
   > mentioned in the standard are required; some are optional.   
   >   
   > Peter   
   >   
   >   
      
   C99 allows the use of extended (i.e. non-standard) integer types in the   
   typedefs provided by stdint.h. That means that wether or not the type   
   names introduced in cstdint are typedefs there is no guarantee that they   
   are typedefs for the required set of integer types.   
      
   IOWs they are not required to be (in the OP's phrasing) 'normal' integer   
   types.   
      
   That means (I think) that if you need portability you will need to use a   
   template, perhaps specialised for the standard types. You could, I   
   think, create a template that would fail in general and then specialise   
   it for the standard integer types. At least that way you would get an   
   error message if an implementation used an extended integer type.   
      
   Francis   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- 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