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,727 of 33,346    |
|    Edmund Kapusniak to All    |
|    stdint.h and function overloading    |
|    13 Dec 12 16:16:53    |
      From: birotanker@this.is.invalid              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;               I am wondering because - I think - in modern C++ the character types       wchar_t, char16_t, and char32_t are distinct types rather than typedefs       of short or int? This doesn't seem to be necessarily the case for       int32_t and friends.               This question affects function overloading, as I would like to make a       set of functions overloaded on every possible integer type. If the       types in stdint.h are guaranteed to correspond to 'normal' types then       it's sufficient to use only those types. Otherwise I potentially       (depending on the platform) also need overloads for some or all of the       stdint.h types.               Also strict aliasing gives rise to a similar problem - to access all       different integer types in a generic way I need code paths for each       different type, to ensure that I am accessing each through a pointer       of the same type. That means an extra code path for each stdint.h       type which has its own __compiler_magic_type. (Leaving aside for the       moment the problem of working out which 'normal' integer type to use       for each stdint.h type.)               Answers very much appreciated,              Edmund Kapusniak                     --        [ 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