however, this does work:
#include <iostream> template<int size> struct ptrsize { }; template<> struct ptrsize<4> { typedef int int_t; typedef unsigned int uint_t; }; template<> struct ptrsize<8> { typedef long long int_t; typedef unsigned long long uint_t; }; typedef ptrsize<sizeof(void*)>::int_t ptrint_t; typedef ptrsize<sizeof(void*)>::uint_t ptruint_t; int main(int ac, char **av) { ptrint_t i = 5; std::cout << i << ", " << sizeof(i) << std::endl; return 0; }
In the discussion between you and I that spawned this, its not even C++ being evil that is the problem. Its the craptastic C API I’m programming against that has a generic void* argument that can be a pointer sometimes and an integer other times. Maybe 15 years ago that seemed like a good idea, but, dammit, just make two function calls or something. Oh wait, no function overloading in C.
Its C that is satan…which I guess, you’re right, make C++ the span of Satan.