C++ is the spawn of satan

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;
}
This entry was posted in tech. Bookmark the permalink.

One Response to C++ is the spawn of satan

  1. Keith says:

    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.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>